From 8147a9a796ff3530d407c8ed4421efae5515fa71 Mon Sep 17 00:00:00 2001 From: lresende Date: Sat, 31 Jan 2009 05:27:28 +0000 Subject: Moving samples that are not part of the main build to contrib folder git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@739507 13f79535-47bb-0310-9956-ffa450edef68 --- .../contrib/samples/binding-echo-extension/README | 74 +++ .../samples/binding-echo-extension/build.xml | 51 ++ .../contrib/samples/binding-echo-extension/pom.xml | 78 +++ .../src/main/java/echo/EchoBinding.java | 29 + .../src/main/java/echo/EchoBindingFactory.java | 33 ++ .../java/echo/impl/EchoBindingFactoryImpl.java | 34 ++ .../src/main/java/echo/impl/EchoBindingImpl.java | 104 ++++ .../main/java/echo/impl/EchoBindingProcessor.java | 128 ++++ .../java/echo/provider/EchoBindingInvoker.java | 48 ++ .../echo/provider/EchoBindingPoliciedInvoker.java | 71 +++ .../echo/provider/EchoBindingProviderFactory.java | 58 ++ .../provider/EchoReferenceBindingProvider.java | 71 +++ .../echo/provider/EchoServiceBindingProvider.java | 78 +++ .../policy/EchoBindingEncryptionPolicy.java | 41 ++ .../EchoBindingEncryptionPolicyProcessor.java | 37 ++ .../echo/provider/policy/EchoBindingPolicy.java | 43 ++ .../policy/EchoBindingPolicyProcessor.java | 78 +++ .../provider/policy/EncryptionPolicyHandler.java | 48 ++ .../echo/provider/policy/EncryptionStrategy.java | 26 + .../java/echo/provider/policy/PolicyHandler.java | 29 + .../provider/policy/ReverseEncryptionStrategy.java | 33 ++ .../main/java/echo/provider/policy/WSPolicy.java | 43 ++ .../echo/provider/policy/WSPolicyProcessor.java | 54 ++ .../src/main/java/echo/server/EchoServer.java | 78 +++ .../main/java/echo/server/EchoServiceListener.java | 52 ++ .../META-INF/services/echo.EchoBindingFactory | 19 + ...ca.contribution.processor.StAXArtifactProcessor | 21 + ...any.sca.contribution.processor.ValidationSchema | 19 + ...che.tuscany.sca.provider.BindingProviderFactory | 19 + .../src/main/resources/sample-binding-echo.xsd | 36 ++ .../src/test/java/echo/Echo.java | 29 + .../src/test/java/echo/EchoComponentImpl.java | 44 ++ .../src/test/java/echo/EchoReferenceTestCase.java | 50 ++ .../src/test/java/echo/EchoServiceTestCase.java | 50 ++ .../src/test/resources/EchoBinding.composite | 43 ++ .../src/test/resources/definitions.xml | 39 ++ java/sca/contrib/samples/binding-echo/README | 104 ++++ .../contrib/samples/binding-echo/binding-echo.png | Bin 0 -> 7846 bytes .../contrib/samples/binding-echo/binding-echo.svg | 174 ++++++ java/sca/contrib/samples/binding-echo/build.xml | 75 +++ java/sca/contrib/samples/binding-echo/pom.xml | 71 +++ .../binding-echo/src/main/java/echo/Echo.java | 29 + .../src/main/java/echo/EchoBindingClient.java | 51 ++ .../src/main/java/echo/EchoComponentImpl.java | 44 ++ .../src/main/resources/EchoBinding.composite | 40 ++ .../src/test/java/echo/EchoBindingTestCase.java | 57 ++ .../samples/binding-notification-broker/README | 112 ++++ .../binding-notification-broker.png | Bin 0 -> 36945 bytes .../samples/binding-notification-broker/build.xml | 75 +++ .../samples/binding-notification-broker/pom.xml | 98 +++ .../java/notification/broker/TestCaseProducer.java | 24 + .../java/notification/broker/TrafficAdvisory.java | 30 + .../broker/TrafficAdvisoryConsumer.java | 41 ++ .../broker/TrafficAdvisoryProducer.java | 36 ++ .../notification/broker/TrafficAdvisoryServer.java | 72 +++ .../TrafficAdvisoryNotification.componentType | 34 ++ .../TrafficAdvisoryNotification.composite | 61 ++ .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 ++ .../samples/binding-notification-consumer/README | 109 ++++ .../binding-notification-consumer.png | Bin 0 -> 27279 bytes .../binding-notification-consumer/build.xml | 75 +++ .../samples/binding-notification-consumer/pom.xml | 116 ++++ .../notification/consumer/TrafficAdvisory.java | 30 + .../consumer/TrafficAdvisoryConsumer.java | 41 ++ .../consumer/TrafficAdvisoryServer.java | 48 ++ .../TrafficAdvisoryNotification.componentType | 34 ++ .../TrafficAdvisoryNotification.composite | 53 ++ .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 ++ .../consumer/TrafficAdvisoryTestCase.java | 61 ++ .../samples/binding-notification-producer/README | 133 +++++ .../binding-notification-producer.png | Bin 0 -> 21631 bytes .../binding-notification-producer/build.xml | 75 +++ .../samples/binding-notification-producer/pom.xml | 127 ++++ .../notification/producer/TestCaseProducer.java | 24 + .../notification/producer/TrafficAdvisory.java | 30 + .../producer/TrafficAdvisoryProducer.java | 36 ++ .../producer/TrafficAdvisoryServer.java | 57 ++ .../TrafficAdvisoryNotification.componentType | 34 ++ .../TrafficAdvisoryNotification.composite | 44 ++ .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 ++ .../producer/TrafficAdvisoryTestCase.java | 78 +++ .../samples/calculator-corba-reference/README | 83 +++ .../samples/calculator-corba-reference/pom.xml | 74 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/CalculatorClient.java | 44 ++ .../main/java/calculator/CalculatorService.java | 39 ++ .../java/calculator/CalculatorServiceImpl.java | 68 +++ .../src/main/java/calculator/DivideService.java | 28 + .../src/main/java/calculator/MultiplyService.java | 28 + .../src/main/java/calculator/SubtractService.java | 28 + .../resources/CalculatorCORBAReference.composite | 42 ++ .../CalculatorCORBAReferenceTestCase.java | 82 +++ .../java/calculator/CalculatorCORBAServant.java | 44 ++ .../calculator/idl/CalculatorCORBAService.java | 32 + .../idl/CalculatorCORBAServiceOperations.java | 36 ++ .../idl/_CalculatorCORBAServiceImplBase.java | 120 ++++ .../src/test/resources/CalculatorCORBA.idl | 33 ++ .../samples/calculator-corba-service/README | 82 +++ .../samples/calculator-corba-service/pom.xml | 74 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 30 + .../main/java/calculator/CalculatorService.java | 36 ++ .../java/calculator/CalculatorServiceImpl.java | 68 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../main/resources/CalculatorCORBAServer.composite | 53 ++ .../calculator/CalculatorCORBAServerTestCase.java | 64 ++ .../calculator/idl/CalculatorCORBAService.java | 32 + .../idl/CalculatorCORBAServiceHelper.java | 104 ++++ .../idl/CalculatorCORBAServiceHolder.java | 57 ++ .../idl/CalculatorCORBAServiceOperations.java | 36 ++ .../idl/_CalculatorCORBAServiceStub.java | 143 +++++ .../src/test/resources/CalculatorCORBA.idl | 33 ++ .../contrib/samples/calculator-distributed/README | 438 ++++++++++++++ .../samples/calculator-distributed/build.xml | 111 ++++ .../calculator-distributed.png | Bin 0 -> 76839 bytes .../calculator-distributed.svg | 383 ++++++++++++ .../samples/calculator-distributed/cloud.composite | 26 + .../calculator-distributed/domain.composite | 26 + .../contrib/samples/calculator-distributed/pom.xml | 119 ++++ .../src/main/java/calculator/AddService.java | 31 + .../src/main/java/calculator/AddServiceImpl.java | 31 + .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 74 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 31 + .../main/java/calculator/SubtractServiceImpl.java | 31 + .../src/main/java/node/LaunchCalculatorNodeA.java | 67 +++ .../src/main/java/node/LaunchCalculatorNodeB.java | 28 + .../src/main/java/node/LaunchCalculatorNodeC.java | 28 + .../src/main/java/node/LaunchDomain.java | 33 ++ .../src/main/resources/cloud/NodeA.composite | 33 ++ .../src/main/resources/cloud/NodeB.composite | 33 ++ .../src/main/resources/cloud/NodeC.composite | 33 ++ .../src/main/resources/nodeA/Calculator.composite | 41 ++ .../resources/nodeA/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeB/Calculator.composite | 29 + .../resources/nodeB/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeC/Calculator.composite | 29 + .../resources/nodeC/META-INF/sca-contribution.xml | 24 + .../calculator/CalculatorDistributedTestCase.java | 92 +++ .../samples/calculator-distributed/workspace.xml | 25 + .../calculator-implementation-policies/README | 266 +++++++++ .../calculator-implementation-policies/build.xml | 72 +++ .../calculator.png | Bin 0 -> 20552 bytes .../calculator.svg | 329 +++++++++++ .../calculator-implementation-policies/pom.xml | 78 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 35 ++ .../src/main/java/calculator/CalculatorClient.java | 66 +++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 70 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 35 ++ .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 35 ++ .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 35 ++ .../security/CalculatorCallbackHandler.java | 50 ++ .../java/calculator/security/JaasLoginModule.java | 178 ++++++ .../java/calculator/security/UserPrincipal.java | 66 +++ .../src/main/resources/Calculator.composite | 61 ++ .../src/main/resources/CalculatorJass.config | 3 + .../resources/CalculatorLogMessages.properties | 18 + .../src/main/resources/definitions.xml | 40 ++ .../test/java/calculator/CalculatorTestCase.java | 74 +++ java/sca/contrib/samples/calculator-lean/README | 87 +++ .../contrib/samples/calculator-lean/calculator.png | Bin 0 -> 20552 bytes .../contrib/samples/calculator-lean/calculator.svg | 329 +++++++++++ java/sca/contrib/samples/calculator-lean/pom.xml | 71 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 35 ++ .../src/main/java/calculator/CalculatorClient.java | 51 ++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 70 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 35 ++ .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 35 ++ .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 35 ++ .../src/main/resources/Calculator.composite | 54 ++ .../src/main/resources/CalculatorTest.composite | 32 + .../test/java/calculator/CalculatorTestCase.java | 62 ++ .../samples/calculator-rcp/build.properties | 5 + .../samples/calculator-rcp/icons/alt_window_16.gif | Bin 0 -> 637 bytes .../samples/calculator-rcp/icons/alt_window_32.gif | Bin 0 -> 1192 bytes java/sca/contrib/samples/calculator-rcp/plugin.xml | 31 + java/sca/contrib/samples/calculator-rcp/pom.xml | 126 ++++ .../src/main/java/Calculator.composite | 54 ++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 35 ++ .../src/main/java/calculator/CalculatorClient.java | 52 ++ .../main/java/calculator/CalculatorService.java | 34 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 35 ++ .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 35 ++ .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 35 ++ .../src/main/java/calculator/rcp/Activator.java | 94 +++ .../src/main/java/calculator/rcp/Application.java | 63 ++ .../rcp/ApplicationActionBarAdvisor.java | 65 ++ .../rcp/ApplicationWorkbenchAdvisor.java | 37 ++ .../rcp/ApplicationWorkbenchWindowAdvisor.java | 44 ++ .../src/main/java/calculator/rcp/Perspective.java | 34 ++ .../src/main/java/calculator/rcp/View.java | 88 +++ java/sca/contrib/samples/calculator-script/README | 105 ++++ .../contrib/samples/calculator-script/build.xml | 72 +++ .../calculator-script/calculator-script.png | Bin 0 -> 23064 bytes .../calculator-script/calculator-script.svg | 334 +++++++++++ java/sca/contrib/samples/calculator-script/pom.xml | 78 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/CalculatorClient.java | 43 ++ .../main/java/calculator/CalculatorService.java | 34 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../src/main/java/calculator/MultiplyService.java | 28 + .../src/main/java/calculator/SubtractService.java | 28 + .../src/main/resources/Calculator.composite | 50 ++ .../main/resources/calculator/AddServiceImpl.js | 22 + .../resources/calculator/DivideServiceImpl.groovy | 22 + .../resources/calculator/MultiplyServiceImpl.py | 20 + .../resources/calculator/SubtractServiceImpl.rb | 21 + .../test/java/calculator/CalculatorTestCase.java | 52 ++ java/sca/contrib/samples/calculator-webapp/README | 118 ++++ .../samples/calculator-webapp/calculator-web.png | Bin 0 -> 22916 bytes .../samples/calculator-webapp/calculator-web.svg | 358 +++++++++++ java/sca/contrib/samples/calculator-webapp/pom.xml | 72 +++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 30 + .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 32 + .../src/main/webapp/WEB-INF/web.composite | 49 ++ .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../calculator-webapp/src/main/webapp/calc.jsp | 47 ++ .../samples/calculator-ws-secure-webapp/README | 116 ++++ .../calculator-ws-secure-webapp/calculator-web.png | Bin 0 -> 25757 bytes .../calculator-ws-secure-webapp/calculator-web.svg | 455 ++++++++++++++ .../samples/calculator-ws-secure-webapp/pom.xml | 102 ++++ .../src/main/java/calculator/AddService.java | 31 + .../src/main/java/calculator/AddServiceImpl.java | 35 ++ .../src/main/java/calculator/CalculatorClient.java | 47 ++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 31 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../calculator/security/ClientPWCBHandler.java | 58 ++ .../calculator/security/ServerPWCBHandler.java | 59 ++ .../src/main/resources/Calculator.composite | 67 +++ ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 21 + .../src/main/resources/calculatorKeys.jks | Bin 0 -> 2706 bytes .../src/main/resources/definitions.xml | 198 +++++++ .../src/main/resources/security.properties | 20 + .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 33 ++ .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/calc.jsp | 50 ++ .../contrib/samples/calculator-ws-webapp/README | 108 ++++ .../calculator-ws-webapp/calculator-web.png | Bin 0 -> 25757 bytes .../calculator-ws-webapp/calculator-web.svg | 455 ++++++++++++++ .../contrib/samples/calculator-ws-webapp/pom.xml | 102 ++++ .../src/main/java/calculator/AddService.java | 31 + .../src/main/java/calculator/AddServiceImpl.java | 34 ++ .../src/main/java/calculator/CalculatorClient.java | 47 ++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../src/main/resources/Calculator.composite | 56 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 ++ .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../calculator-ws-webapp/src/main/webapp/calc.jsp | 50 ++ java/sca/contrib/samples/calculator2/README | 97 +++ java/sca/contrib/samples/calculator2/build.xml | 72 +++ .../sca/contrib/samples/calculator2/calculator.png | Bin 0 -> 20552 bytes .../sca/contrib/samples/calculator2/calculator.svg | 329 +++++++++++ java/sca/contrib/samples/calculator2/pom.xml | 65 ++ .../src/main/java/calculator/AddService.java | 28 + .../src/main/java/calculator/AddServiceImpl.java | 35 ++ .../src/main/java/calculator/CalculatorClient.java | 45 ++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 70 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 35 ++ .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 35 ++ .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 35 ++ .../src/main/resources/Calculator.composite | 49 ++ .../test/java/calculator/CalculatorTestCase.java | 51 ++ java/sca/contrib/samples/callback-ws-client/README | 311 ++++++++++ .../contrib/samples/callback-ws-client/build.xml | 73 +++ .../callback-ws-client/callback-ws-client.png | Bin 0 -> 8812 bytes .../callback-ws-client/callback-ws-client.svg | 204 +++++++ .../sca/contrib/samples/callback-ws-client/pom.xml | 86 +++ .../src/main/java/myapp/MyClient.java | 29 + .../src/main/java/myapp/MyClientImpl.java | 64 ++ .../src/main/java/myserver/MyService.java | 34 ++ .../src/main/java/myserver/MyServiceCallback.java | 30 + .../main/resources/META-INF/sca-contribution.xml | 22 + .../src/main/resources/myapp.composite | 36 ++ .../test/java/myapp/CallbackClientTestCase.java | 53 ++ .../sca/contrib/samples/callback-ws-service/README | 227 +++++++ .../contrib/samples/callback-ws-service/build.xml | 73 +++ .../callback-ws-service/callback-ws-service.png | Bin 0 -> 8949 bytes .../callback-ws-service/callback-ws-service.svg | 200 +++++++ .../contrib/samples/callback-ws-service/pom.xml | 79 +++ .../src/main/java/myserver/CallbackServer.java | 48 ++ .../src/main/java/myserver/MyService.java | 34 ++ .../src/main/java/myserver/MyServiceCallback.java | 30 + .../src/main/java/myserver/MyServiceImpl.java | 56 ++ .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/callbackws.composite | 35 ++ .../test/java/myserver/CallbackServerTestCase.java | 52 ++ java/sca/contrib/samples/callbacks-jms/README | 73 +++ java/sca/contrib/samples/callbacks-jms/build.xml | 72 +++ java/sca/contrib/samples/callbacks-jms/pom.xml | 92 +++ .../src/main/java/callbacks/OrderCallback.java | 30 + .../src/main/java/callbacks/OrderRequest.java | 24 + .../src/main/java/callbacks/OrderResponse.java | 24 + .../src/main/java/callbacks/OrderService.java | 33 ++ .../main/java/callbacks/OrderServiceClient.java | 59 ++ .../src/main/java/callbacks/OrderServiceImpl.java | 51 ++ .../src/main/resources/callbacks.composite | 44 ++ .../src/main/resources/jndi.properties | 30 + .../src/test/java/callbacks/CallbacksTestCase.java | 64 ++ java/sca/contrib/samples/chat-webapp/README | 83 +++ .../contrib/samples/chat-webapp/chat-webapp.png | Bin 0 -> 6552 bytes .../contrib/samples/chat-webapp/chat-webapp.svg | 187 ++++++ java/sca/contrib/samples/chat-webapp/pom.xml | 97 +++ .../src/main/java/sample/ChatService.java | 26 + .../src/main/java/sample/ChatServiceImpl.java | 36 ++ .../chat-webapp/src/main/resources/chat.composite | 40 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../chat-webapp/src/main/webapp/WEB-INF/web.xml | 37 ++ .../samples/chat-webapp/src/main/webapp/chat.html | 70 +++ java/sca/contrib/samples/chat2-webapp/README | 61 ++ java/sca/contrib/samples/chat2-webapp/build.xml | 117 ++++ java/sca/contrib/samples/chat2-webapp/pom.xml | 104 ++++ .../src/main/java/sample/ChatCallback.java | 27 + .../src/main/java/sample/ChatService.java | 32 + .../src/main/java/sample/ChatServiceImpl.java | 36 ++ .../chat2-webapp/src/main/resources/chat.composite | 40 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../chat2-webapp/src/main/webapp/WEB-INF/web.xml | 37 ++ .../samples/chat2-webapp/src/main/webapp/chat.html | 73 +++ .../contrib/samples/customer-dojo-webapp/README | 104 ++++ .../samples/customer-dojo-webapp/build-dojo.xml | 92 +++ .../contrib/samples/customer-dojo-webapp/build.xml | 70 +++ .../customer-dojo-webapp/customer-dojo-jsonrpc.png | Bin 0 -> 9947 bytes .../customer-dojo-webapp/customer-dojo-jsonrpc.svg | 177 ++++++ .../samples/customer-dojo-webapp/customer.sql | 33 ++ .../contrib/samples/customer-dojo-webapp/pom.xml | 232 ++++++++ .../src/main/java/customer/Customer.java | 93 +++ .../src/main/java/customer/CustomerCollection.java | 26 + .../main/java/customer/CustomerCollectionImpl.java | 101 ++++ .../src/main/java/customer/CustomerService.java | 31 + .../main/java/customer/CustomerServiceImpl.java | 117 ++++ .../src/main/java/launch/Launch.java | 34 ++ .../src/main/resources/META-INF/orm.xml | 51 ++ .../src/main/resources/META-INF/persistence.xml | 40 ++ .../main/resources/META-INF/sca-contribution.xml | 26 + .../src/main/resources/customer.composite | 37 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 ++ .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/customer.jsp | 80 +++ java/sca/contrib/samples/customer-dojo/README | 104 ++++ .../contrib/samples/customer-dojo/build-dojo.xml | 92 +++ java/sca/contrib/samples/customer-dojo/build.xml | 70 +++ .../customer-dojo/customer-dojo-jsonrpc.png | Bin 0 -> 9947 bytes .../customer-dojo/customer-dojo-jsonrpc.svg | 177 ++++++ .../sca/contrib/samples/customer-dojo/customer.sql | 33 ++ java/sca/contrib/samples/customer-dojo/pom.xml | 244 ++++++++ .../src/main/java/customer/Customer.java | 93 +++ .../src/main/java/customer/CustomerCollection.java | 26 + .../main/java/customer/CustomerCollectionImpl.java | 101 ++++ .../src/main/java/customer/CustomerService.java | 31 + .../main/java/customer/CustomerServiceImpl.java | 117 ++++ .../customer-dojo/src/main/java/launch/Launch.java | 35 ++ .../src/main/resources/META-INF/orm.xml | 51 ++ .../src/main/resources/META-INF/persistence.xml | 40 ++ .../main/resources/META-INF/sca-contribution.xml | 26 + .../src/main/resources/content/customer.html | 77 +++ .../src/main/resources/customer.composite | 44 ++ java/sca/contrib/samples/databinding-echo/README | 143 +++++ .../sca/contrib/samples/databinding-echo/build.xml | 75 +++ .../samples/databinding-echo/databinding-echo.png | Bin 0 -> 23907 bytes .../samples/databinding-echo/databinding-echo.svg | 408 +++++++++++++ java/sca/contrib/samples/databinding-echo/pom.xml | 82 +++ .../src/main/java/dbecho/ComponentAImpl.java | 74 +++ .../src/main/java/dbecho/ComponentBImpl.java | 59 ++ .../src/main/java/dbecho/Echo.java | 32 + .../main/java/dbecho/EchoDataBindingClient.java | 45 ++ .../src/main/java/dbecho/Interface1.java | 32 + .../src/main/java/dbecho/Interface2.java | 36 ++ .../src/main/resources/EchoDataBinding.composite | 58 ++ .../src/main/resources/wsdl/echo.wsdl | 63 ++ .../test/java/dbecho/EchoDataBindingTestCase.java | 49 ++ java/sca/contrib/samples/domain-management/README | 8 + java/sca/contrib/samples/domain-management/pom.xml | 247 ++++++++ .../java/manager/DistributeAndRunComponents.java | 328 ++++++++++ .../main/java/manager/DistributeComponents.java | 288 +++++++++ .../src/main/java/manager/ListComponents.java | 158 +++++ .../src/main/java/manager/ListDependencies.java | 108 ++++ .../src/main/java/manager/ListDeployables.java | 73 +++ .../src/main/java/manager/WireComponents.java | 218 +++++++ .../src/test/java/services/Cart.java | 28 + .../src/test/java/services/Item.java | 66 +++ .../test/java/services/ShoppingCartClientImpl.java | 57 ++ .../src/test/java/services/ShoppingCartImpl.java | 100 ++++ .../src/test/resources/assembly/assets.xml | 38 ++ .../src/test/resources/assembly/client.xml | 34 ++ .../src/test/resources/assembly/store.xml | 34 ++ .../resources/assets/META-INF/sca-contribution.xml | 22 + .../resources/client/META-INF/sca-contribution.xml | 24 + .../src/test/resources/client/client.composite | 35 ++ .../resources/store/META-INF/sca-contribution.xml | 24 + .../src/test/resources/store/store.composite | 32 + java/sca/contrib/samples/domain-webapp/README | 310 ++++++++++ java/sca/contrib/samples/domain-webapp/build.xml | 296 +++++++++ java/sca/contrib/samples/domain-webapp/pom.xml | 101 ++++ .../src/main/java/node/DomainServer.java | 54 ++ .../main/resources/META-INF/sca-contribution.xml | 24 + .../src/main/resources/domain.composite | 54 ++ .../src/main/resources/webroot/index.html | 354 +++++++++++ .../src/main/resources/webroot/node.png | Bin 0 -> 689 bytes .../src/main/resources/webroot/style.css | 176 ++++++ .../contrib/samples/feed-aggregator-webapp/README | 55 ++ .../feed-aggregator-webapp.png | Bin 0 -> 23443 bytes .../feed-aggregator-webapp.svg | 382 ++++++++++++ .../contrib/samples/feed-aggregator-webapp/pom.xml | 108 ++++ .../src/main/java/feed/AggregatorImpl.java | 178 ++++++ .../src/main/java/feed/Sort.java | 38 ++ .../src/main/java/feed/SortImpl.java | 57 ++ .../src/main/resources/FeedAggregator.composite | 60 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 26 + .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/index.html | 32 + java/sca/contrib/samples/feed-aggregator/README | 110 ++++ java/sca/contrib/samples/feed-aggregator/build.xml | 72 +++ .../samples/feed-aggregator/feed-aggregator.png | Bin 0 -> 17429 bytes .../samples/feed-aggregator/feed-aggregator.svg | 364 ++++++++++++ java/sca/contrib/samples/feed-aggregator/pom.xml | 84 +++ .../src/main/java/feed/AggregatorImpl.java | 188 ++++++ .../feed-aggregator/src/main/java/feed/Sort.java | 38 ++ .../src/main/java/feed/SortImpl.java | 57 ++ .../src/main/java/launch/LaunchFeedServer.java | 47 ++ .../src/main/resources/FeedAggregator.composite | 60 ++ .../src/test/java/feed/FeedAggregatorTest.java | 332 +++++++++++ java/sca/contrib/samples/helloworld-bpel-ws/README | 151 +++++ .../contrib/samples/helloworld-bpel-ws/build.xml | 95 +++ .../samples/helloworld-bpel-ws/helloworld-bpel.png | Bin 0 -> 8897 bytes .../samples/helloworld-bpel-ws/helloworld-bpel.svg | 179 ++++++ .../sca/contrib/samples/helloworld-bpel-ws/pom.xml | 205 +++++++ .../src/main/java/helloworld/BPELClient.java | 43 ++ .../src/main/resources/deploy.xml | 31 + .../src/main/resources/helloworld.bpel | 66 +++ .../src/main/resources/helloworld.componentType | 30 + .../src/main/resources/helloworld.composite | 33 ++ .../src/main/resources/helloworld.wsdl | 82 +++ .../src/main/resources/log4j.properties | 35 ++ .../java/helloworld/BPELHelloWorldTestCase.java | 59 ++ java/sca/contrib/samples/helloworld-bpel/README | 151 +++++ java/sca/contrib/samples/helloworld-bpel/build.xml | 95 +++ .../samples/helloworld-bpel/helloworld-bpel.png | Bin 0 -> 8897 bytes .../samples/helloworld-bpel/helloworld-bpel.svg | 179 ++++++ java/sca/contrib/samples/helloworld-bpel/pom.xml | 198 +++++++ .../src/main/java/helloworld/BPELClient.java | 43 ++ .../helloworld-bpel/src/main/resources/deploy.xml | 31 + .../src/main/resources/helloworld.bpel | 66 +++ .../src/main/resources/helloworld.componentType | 30 + .../src/main/resources/helloworld.composite | 29 + .../src/main/resources/helloworld.wsdl | 82 +++ .../src/main/resources/log4j.properties | 35 ++ .../java/helloworld/BPELHelloWorldTestCase.java | 59 ++ .../contrib/samples/helloworld-distributed/README | 29 + .../helloworld-distributed/helloworld-node/README | 29 + .../helloworld-distributed/helloworld-node/pom.xml | 57 ++ .../src/main/java/sample/Helloworld.java | 29 + .../src/main/java/sample/HelloworldImpl.java | 29 + .../META-INF/sca-deployables/Helloworld.composite | 28 + .../helloworld-webapp/README | 29 + .../helloworld-webapp/build.xml | 127 ++++ .../helloworld-webapp/pom.xml | 78 +++ .../src/main/java/sample/Helloworld.java | 27 + .../src/main/webapp/WEB-INF/web.composite | 29 + .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../helloworld-webapp/src/main/webapp/hello.jsp | 36 ++ .../contrib/samples/helloworld-dojo-webapp/README | 104 ++++ .../samples/helloworld-dojo-webapp/build-dojo.xml | 92 +++ .../samples/helloworld-dojo-webapp/build.xml | 70 +++ .../helloworld-dojo-webapp/helloworld-jsonrpc.png | Bin 0 -> 9947 bytes .../helloworld-dojo-webapp/helloworld-jsonrpc.svg | 177 ++++++ .../contrib/samples/helloworld-dojo-webapp/pom.xml | 163 +++++ .../java/helloworldjsonrpc/HelloWorldService.java | 28 + .../helloworldjsonrpc/HelloWorldServiceImpl.java | 38 ++ .../src/main/resources/jsonrpc.composite | 37 ++ .../src/main/webapp/HelloWorldJSONRPC.html | 98 +++ .../src/main/webapp/META-INF/sca-contribution.xml | 26 + .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/style.css | 22 + .../contrib/samples/helloworld-jms-webapp/README | 130 ++++ .../contrib/samples/helloworld-jms-webapp/pom.xml | 72 +++ .../src/main/java/helloworld/HelloWorldClient.java | 37 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../java/helloworld/HelloWorldServiceImpl.java | 34 ++ .../src/main/webapp/META-INF/context.xml | 29 + .../META-INF/sca-deployables/HelloWorld.composite | 39 ++ .../src/main/webapp/WEB-INF/web.xml | 66 +++ .../src/main/webapp/hello.jsp | 44 ++ .../samples/helloworld-jsonrpc-webapp/README | 90 +++ .../helloworld-jsonrpc.png | Bin 0 -> 9947 bytes .../helloworld-jsonrpc.svg | 177 ++++++ .../samples/helloworld-jsonrpc-webapp/pom.xml | 103 ++++ .../java/helloworldjsonrpc/HelloWorldService.java | 28 + .../helloworldjsonrpc/HelloWorldServiceImpl.java | 36 ++ .../src/main/resources/jsonrpc.composite | 37 ++ .../src/main/webapp/HelloWorldJSONRPC.html | 75 +++ .../src/main/webapp/META-INF/sca-contribution.xml | 26 + .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/style.css | 22 + java/sca/contrib/samples/helloworld-jsp/pom.xml | 54 ++ .../src/main/java/sample/HelloworldService.java | 7 + .../main/java/sample/HelloworldServiceImpl.java | 12 + .../webapp/META-INF/sca-deployables/web.composite | 34 ++ .../helloworld-jsp/src/main/webapp/WEB-INF/web.xml | 42 ++ .../helloworld-jsp/src/main/webapp/hello.jsp | 36 ++ .../samples/helloworld-reference-jms/README | 114 ++++ .../samples/helloworld-reference-jms/build.xml | 72 +++ .../helloworld-reference.png | Bin 0 -> 12973 bytes .../helloworld-reference.svg | 144 +++++ .../samples/helloworld-reference-jms/pom.xml | 92 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../main/java/helloworld/HelloWorldJmsClient.java | 41 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../helloworld/HelloWorldServiceComponent.java | 42 ++ .../resources/helloworldjmsreference.composite | 40 ++ .../main/resources/helloworldjmsservice.composite | 39 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../helloworld/HelloWorldJmsClientTestCase.java | 80 +++ .../contrib/samples/helloworld-service-jms/README | 101 ++++ .../samples/helloworld-service-jms/build.xml | 72 +++ .../helloworld-service-jms/helloworld-service.png | Bin 0 -> 9455 bytes .../helloworld-service-jms/helloworld-service.svg | 139 +++++ .../contrib/samples/helloworld-service-jms/pom.xml | 85 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../src/main/java/helloworld/HelloWorldServer.java | 58 ++ .../main/java/helloworld/HelloWorldService.java | 31 + .../src/main/resources/definitions.xml | 66 +++ .../main/resources/helloworldjmsservice.composite | 40 ++ .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../helloworld/HelloWorldJmsServerTestCaseOff.java | 60 ++ .../sca/contrib/samples/helloworld-servlet/pom.xml | 61 ++ .../src/main/java/sample/HelloworldService.java | 7 + .../main/java/sample/HelloworldServiceImpl.java | 12 + .../src/main/java/sample/HelloworldServlet.java | 65 ++ .../webapp/META-INF/sca-deployables/web.composite | 33 ++ .../src/main/webapp/WEB-INF/web.xml | 52 ++ .../helloworld-servlet/src/main/webapp/hello.html | 46 ++ .../samples/helloworld-web-callback/pom.xml | 68 +++ .../src/main/java/sample/HelloworldCallback.java | 30 + .../src/main/java/sample/HelloworldService.java | 14 + .../main/java/sample/HelloworldServiceImpl.java | 27 + .../webapp/META-INF/sca-deployables/web.composite | 45 ++ .../src/main/webapp/WEB-INF/web.xml | 42 ++ .../src/main/webapp/hello.html | 63 ++ java/sca/contrib/samples/helloworld-web/pom.xml | 68 +++ .../src/main/java/sample/HelloworldService.java | 7 + .../main/java/sample/HelloworldServiceImpl.java | 12 + .../webapp/META-INF/sca-deployables/web.composite | 39 ++ .../helloworld-web/src/main/webapp/WEB-INF/web.xml | 42 ++ .../helloworld-web/src/main/webapp/hello.html | 62 ++ .../samples/helloworld-ws-deep-webapp/README | 1 + .../samples/helloworld-ws-deep-webapp/build.xml | 158 +++++ .../samples/helloworld-ws-deep-webapp/pom.xml | 45 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../main/java/helloworld/HelloWorldService.java | 30 + .../sca-deployables/helloworldws.composite | 32 + .../src/main/resources/wsdl/helloworld.wsdl | 79 +++ .../src/main/webapp/WEB-INF/web.xml | 27 + .../samples/helloworld-ws-reference-jms/README | 127 ++++ .../samples/helloworld-ws-reference-jms/build.xml | 72 +++ .../helloworld-ws-reference.png | Bin 0 -> 7549 bytes .../helloworld-ws-reference.svg | 150 +++++ .../samples/helloworld-ws-reference-jms/pom.xml | 92 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../main/java/helloworld/HelloWorldJmsClient.java | 38 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../helloworld/HelloWorldServiceComponent.java | 42 ++ .../src/main/resources/helloworldwsjms.composite | 34 ++ .../main/resources/helloworldwsjmsclient.composite | 45 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../helloworld/HelloWorldJmsClientTestCase.java | 84 +++ .../samples/helloworld-ws-reference-lean/README | 178 ++++++ .../helloworld-ws-reference.png | Bin 0 -> 7549 bytes .../helloworld-ws-reference.svg | 150 +++++ .../samples/helloworld-ws-reference-lean/pom.xml | 79 +++ .../src/main/java/helloworld/HelloWorldClient.java | 47 ++ .../main/java/helloworld/HelloWorldClient2.java | 53 ++ .../main/java/helloworld/HelloWorldClient3.java | 47 ++ .../main/java/helloworld/HelloWorldClient4.java | 52 ++ .../main/java/helloworld/HelloWorldClient5.java | 47 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../main/resources/helloworldwsclient.composite | 33 ++ .../main/resources/helloworldwsclient2.composite | 33 ++ .../main/resources/helloworldwsclient3.composite | 33 ++ .../main/resources/helloworldwsclient4.composite | 34 ++ .../main/resources/helloworldwsclient5.composite | 33 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../java/helloworld/HelloWorldClientTestCase.java | 58 ++ .../test/java/helloworld/HelloWorldTestServer.java | 55 ++ .../samples/helloworld-ws-reference-secure/README | 176 ++++++ .../helloworld-ws-reference-secure/build.xml | 72 +++ .../helloworld-ws-reference-secure.png | Bin 0 -> 7549 bytes .../helloworld-ws-reference-secure.svg | 150 +++++ .../samples/helloworld-ws-reference-secure/pom.xml | 85 +++ .../main/java/helloworld/ClientPWCBHandler.java | 45 ++ .../src/main/java/helloworld/HelloWorldClient.java | 42 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../helloworld/HelloWorldServiceComponent.java | 42 ++ ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 21 + .../src/main/resources/definitions.xml | 203 +++++++ .../src/main/resources/helloworldKeys.jks | Bin 0 -> 1366 bytes .../main/resources/helloworldwsclient.composite | 58 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 85 +++ .../java/helloworld/HelloWorldClientTestCase.java | 74 +++ .../test/java/helloworld/HelloWorldTestServer.java | 55 ++ .../contrib/samples/helloworld-ws-reference/README | 178 ++++++ .../samples/helloworld-ws-reference/build.xml | 72 +++ .../helloworld-ws-reference.png | Bin 0 -> 7549 bytes .../helloworld-ws-reference.svg | 150 +++++ .../samples/helloworld-ws-reference/pom.xml | 79 +++ .../src/main/java/helloworld/HelloWorldClient.java | 38 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../helloworld/HelloWorldServiceComponent.java | 42 ++ .../main/resources/helloworldwsclient.composite | 45 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../java/helloworld/HelloWorldClientTestCase.java | 74 +++ .../test/java/helloworld/HelloWorldTestServer.java | 55 ++ .../samples/helloworld-ws-sdo-webapp/README | 92 +++ .../samples/helloworld-ws-sdo-webapp/build.xml | 99 ++++ .../helloworld-ws-sdo-webapp.png | Bin 0 -> 12242 bytes .../helloworld-ws-sdo-webapp.svg | 221 +++++++ .../samples/helloworld-ws-sdo-webapp/pom.xml | 200 +++++++ .../src/main/java/helloworld/HelloWorld.java | 44 ++ .../main/java/helloworld/HelloWorldComponent.java | 40 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 48 ++ .../src/main/resources/helloworldws.composite | 43 ++ .../src/main/resources/wsdl/helloworld.wsdl | 111 ++++ .../src/main/resources/wsdl/helloworld.xsd | 30 + .../src/main/webapp/HelloWorld.jsp | 48 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 41 ++ .../src/main/webapp/WEB-INF/web.xml | 46 ++ java/sca/contrib/samples/helloworld-ws-sdo/README | 214 +++++++ .../contrib/samples/helloworld-ws-sdo/build.xml | 101 ++++ .../helloworld-ws-sdo/helloworld-ws-sdo.png | Bin 0 -> 7549 bytes .../helloworld-ws-sdo/helloworld-ws-sdo.svg | 150 +++++ java/sca/contrib/samples/helloworld-ws-sdo/pom.xml | 139 +++++ .../src/main/java/helloworld/HelloWorldClient.java | 44 ++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../src/main/java/helloworld/HelloWorldServer.java | 46 ++ .../main/java/helloworld/HelloWorldService.java | 29 + .../helloworld/HelloWorldServiceComponent.java | 42 ++ .../src/main/resources/helloworldws.composite | 32 + .../main/resources/helloworldwsclient.composite | 33 ++ .../src/main/resources/logging.properties | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 88 +++ .../java/helloworld/HelloWorldClientTestCase.java | 69 +++ .../test/java/helloworld/HelloWorldTestServer.java | 55 ++ .../samples/helloworld-ws-service-jms/README | 119 ++++ .../samples/helloworld-ws-service-jms/build.xml | 72 +++ .../helloworld-ws-service.png | Bin 0 -> 6531 bytes .../helloworld-ws-service.svg | 150 +++++ .../samples/helloworld-ws-service-jms/pom.xml | 87 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../src/main/java/helloworld/HelloWorldServer.java | 60 ++ .../main/java/helloworld/HelloWorldService.java | 31 + .../src/main/resources/definitions.xml | 66 +++ .../src/main/resources/helloworldwsjms.composite | 35 ++ .../main/resources/helloworldwsjmspolicy.composite | 34 ++ .../src/main/resources/wsdl/helloworld.wsdl | 92 +++ .../HelloWorldJmsPolicyServerTestCase.java | 68 +++ .../helloworld/HelloWorldJmsServerTestCase.java | 72 +++ .../samples/helloworld-ws-service-secure/README | 152 +++++ .../samples/helloworld-ws-service-secure/build.xml | 72 +++ .../helloworld-ws-service-secure.png | Bin 0 -> 158 bytes .../helloworld-ws-service-secure.svg | 149 +++++ .../samples/helloworld-ws-service-secure/pom.xml | 85 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../src/main/java/helloworld/HelloWorldServer.java | 46 ++ .../main/java/helloworld/HelloWorldService.java | 31 + .../main/java/helloworld/ServerPWCBHandler.java | 55 ++ .../src/main/resources/definitions.xml | 113 ++++ .../src/main/resources/helloworldKeys.jks | Bin 0 -> 1366 bytes .../src/main/resources/helloworldws.composite | 41 ++ .../src/main/resources/wsdl/helloworld.wsdl | 79 +++ .../java/helloworld/HelloWorldServerTestCase.java | 62 ++ .../samples/helloworld-ws-service-webapp/README | 1 + .../samples/helloworld-ws-service-webapp/build.xml | 156 +++++ .../samples/helloworld-ws-service-webapp/pom.xml | 80 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../main/java/helloworld/HelloWorldService.java | 30 + .../src/main/resources/wsdl/helloworld.wsdl | 79 +++ .../sca-deployables/helloworldws.composite | 32 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 33 ++ .../src/main/webapp/WEB-INF/web.xml | 45 ++ .../contrib/samples/helloworld-ws-service/README | 140 +++++ .../samples/helloworld-ws-service/build.xml | 72 +++ .../helloworld-ws-service.png | Bin 0 -> 6531 bytes .../helloworld-ws-service.svg | 150 +++++ .../contrib/samples/helloworld-ws-service/pom.xml | 79 +++ .../src/main/java/helloworld/HelloWorldImpl.java | 33 ++ .../src/main/java/helloworld/HelloWorldServer.java | 46 ++ .../main/java/helloworld/HelloWorldService.java | 31 + .../org/example/orderservice/ObjectFactory.java | 56 ++ .../main/java/org/example/orderservice/Order.java | 129 ++++ .../org/example/orderservice/OrderService.java | 37 ++ .../org/example/orderservice/OrderServiceImpl.java | 65 ++ .../example/orderservice/OrderService_Service.java | 66 +++ .../java/org/example/orderservice/ReviewOrder.java | 64 ++ .../example/orderservice/ReviewOrderResponse.java | 64 ++ .../main/java/org/example/orderservice/Status.java | 57 ++ .../org/example/orderservice/package-info.java | 2 + .../sca-deployables/helloworldws.composite | 33 ++ .../META-INF/sca-deployables/orderws.composite | 33 ++ .../src/main/resources/wsdl/helloworld.wsdl | 79 +++ .../src/main/resources/wsdl/orderservice.wsdl | 71 +++ .../java/helloworld/HelloWorldServerTestCase.java | 62 ++ .../contrib/samples/host-webapp-calculator/README | 108 ++++ .../samples/host-webapp-calculator/build.xml | 31 + .../host-webapp-calculator/calculator-web.png | Bin 0 -> 25757 bytes .../host-webapp-calculator/calculator-web.svg | 455 ++++++++++++++ .../contrib/samples/host-webapp-calculator/pom.xml | 162 +++++ .../src/main/java/calculator/AddService.java | 31 + .../src/main/java/calculator/AddServiceImpl.java | 34 ++ .../main/java/calculator/CalculatorService.java | 35 ++ .../java/calculator/CalculatorServiceImpl.java | 69 +++ .../src/main/java/calculator/DivideService.java | 28 + .../main/java/calculator/DivideServiceImpl.java | 30 + .../src/main/java/calculator/MultiplyService.java | 28 + .../main/java/calculator/MultiplyServiceImpl.java | 30 + .../src/main/java/calculator/SubtractService.java | 28 + .../main/java/calculator/SubtractServiceImpl.java | 30 + .../src/main/resources/Calculator.composite | 49 ++ .../src/main/webapp/META-INF/sca-contribution.xml | 23 + .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 ++ .../src/main/webapp/WEB-INF/web.composite | 24 + .../src/main/webapp/WEB-INF/web.xml | 41 ++ .../src/main/webapp/calc.jsp | 50 ++ .../samples/implementation-composite/README | 116 ++++ .../samples/implementation-composite/build.xml | 72 +++ .../implementation-composite.png | Bin 0 -> 47415 bytes .../implementation-composite.svg | 658 +++++++++++++++++++++ .../samples/implementation-composite/pom.xml | 72 +++ .../src/main/java/composite/CompositeClient.java | 41 ++ .../src/main/java/composite/Source.java | 24 + .../src/main/java/composite/SourceCallback.java | 24 + .../src/main/java/composite/SourceImpl.java | 55 ++ .../src/main/java/composite/Target.java | 30 + .../src/main/java/composite/TargetImpl.java | 41 ++ .../src/main/resources/InnerComposite.composite | 41 ++ .../src/main/resources/InnerComposite2.composite | 33 ++ .../main/resources/META-INF/sca-contribution.xml | 25 + .../src/main/resources/OuterComposite.composite | 39 ++ .../src/test/java/composite/CompositeTestCase.java | 51 ++ .../samples/implementation-crud-extension/README | 83 +++ .../implementation-crud-extension/build.xml | 51 ++ .../samples/implementation-crud-extension/pom.xml | 77 +++ .../src/main/java/crud/CRUD.java | 54 ++ .../src/main/java/crud/CRUDImplementation.java | 50 ++ .../main/java/crud/CRUDImplementationFactory.java | 37 ++ .../main/java/crud/backend/ResourceManager.java | 90 +++ .../crud/impl/CRUDImplementationFactoryImpl.java | 47 ++ .../java/crud/impl/CRUDImplementationImpl.java | 117 ++++ .../crud/provider/CRUDImplementationInvoker.java | 79 +++ .../crud/provider/CRUDImplementationProvider.java | 75 +++ .../CRUDImplementationProviderFactory.java | 51 ++ .../services/crud.CRUDImplementationFactory | 19 + ...ca.contribution.processor.StAXArtifactProcessor | 19 + ...any.sca.contribution.processor.ValidationSchema | 19 + ...cany.sca.provider.ImplementationProviderFactory | 19 + .../main/resources/sample-implementation-crud.xsd | 38 ++ .../src/test/java/crud/CRUDTestCase.java | 60 ++ .../src/test/resources/crud.composite | 30 + .../sca/contrib/samples/implementation-crud/README | 113 ++++ .../contrib/samples/implementation-crud/build.xml | 75 +++ .../implementation-crud/implementation-crud.png | Bin 0 -> 4227 bytes .../implementation-crud/implementation-crud.svg | 135 +++++ .../contrib/samples/implementation-crud/pom.xml | 64 ++ .../src/main/java/crud/client/CRUDClient.java | 59 ++ .../src/main/resources/crud.composite | 30 + .../src/test/java/crud/client/CRUDTestCase.java | 61 ++ .../samples/implementation-notification/README | 97 +++ .../samples/implementation-notification/build.xml | 72 +++ .../implementation-notification.png | Bin 0 -> 21543 bytes .../samples/implementation-notification/pom.xml | 76 +++ .../main/java/notification/TestCaseProducer.java | 24 + .../main/java/notification/TrafficAdvisory.java | 24 + .../java/notification/TrafficAdvisoryClient.java | 45 ++ .../java/notification/TrafficAdvisoryConsumer.java | 39 ++ .../java/notification/TrafficAdvisoryProducer.java | 36 ++ .../TrafficAdvisoryNotification.componentType | 30 + .../TrafficAdvisoryNotification.composite | 50 ++ .../java/notification/TrafficAdvisoryTestCase.java | 60 ++ .../TrafficAdvisoryNotification.componentType | 30 + .../TrafficAdvisoryNotification.composite | 50 ++ .../samples/implementation-pojo-extension/README | 70 +++ .../implementation-pojo-extension/build.xml | 51 ++ .../samples/implementation-pojo-extension/pom.xml | 77 +++ .../src/main/java/pojo/POJOImplementation.java | 65 ++ .../main/java/pojo/POJOImplementationFactory.java | 36 ++ .../pojo/impl/POJOImplementationFactoryImpl.java | 36 ++ .../java/pojo/impl/POJOImplementationImpl.java | 155 +++++ .../pojo/impl/POJOImplementationProcessor.java | 174 ++++++ .../pojo/provider/POJOImplementationInvoker.java | 68 +++ .../pojo/provider/POJOImplementationProvider.java | 106 ++++ .../POJOImplementationProviderFactory.java | 45 ++ ...ca.contribution.processor.StAXArtifactProcessor | 19 + ...any.sca.contribution.processor.ValidationSchema | 19 + ...cany.sca.provider.ImplementationProviderFactory | 19 + .../services/pojo.POJOImplementationFactory | 19 + .../main/resources/sample-implementation-pojo.xsd | 38 ++ .../src/test/java/helloworld/HelloWorld.java | 26 + .../src/test/java/helloworld/HelloWorldImpl.java | 37 ++ .../src/test/java/helloworld/HelloWorldImpl2.java | 37 ++ .../test/java/helloworld/HelloWorldTestCase.java | 51 ++ .../helloworld/HelloWorldImpl2.componentType | 26 + .../test/resources/helloworld/helloworld.composite | 33 ++ java/sca/contrib/samples/loanapplication/pom.xml | 65 ++ .../main/java/loanapplication/LoanApplication.java | 36 ++ .../loanapplication/LoanApplicationClient.java | 37 ++ .../src/main/java/loanapplication/LoanClient.java | 29 + .../main/java/loanapplication/LoanClientImpl.java | 64 ++ .../src/main/java/loanapplication/LoanService.java | 43 ++ .../main/java/loanapplication/LoanServiceImpl.java | 63 ++ .../src/main/resources/loanapplication.composite | 34 ++ .../loanapplication/LoanApplicationTestCase.java | 83 +++ java/sca/contrib/samples/osgi-supplychain/README | 161 +++++ .../samples/osgi-supplychain/build-bundles.xml | 32 + .../sca/contrib/samples/osgi-supplychain/build.xml | 128 ++++ .../samples/osgi-supplychain/osgi-supplychain.png | Bin 0 -> 13558 bytes .../samples/osgi-supplychain/osgi-supplychain.svg | 272 +++++++++ java/sca/contrib/samples/osgi-supplychain/pom.xml | 187 ++++++ .../src/main/java/supplychain/OSGiBundleImpl.java | 121 ++++ .../main/java/supplychain/SupplyChainClient.java | 43 ++ .../main/java/supplychain/customer/Customer.java | 33 ++ .../customer/JavaCustomerComponentImpl.java | 50 ++ .../customer/OSGiCustomerComponentImpl.java | 51 ++ .../supplychain/customer/OSGiCustomerImpl.java | 47 ++ .../retailer/JavaRetailerComponentImpl.java | 53 ++ .../retailer/OSGiRetailerComponentImpl.java | 46 ++ .../supplychain/retailer/OSGiRetailerImpl.java | 44 ++ .../main/java/supplychain/retailer/Retailer.java | 28 + .../shipper/JavaShipperComponentImpl.java | 47 ++ .../shipper/OSGiShipperComponentImpl.java | 45 ++ .../java/supplychain/shipper/OSGiShipperImpl.java | 42 ++ .../src/main/java/supplychain/shipper/Shipper.java | 28 + .../warehouse/JavaWarehouseComponentImpl.java | 47 ++ .../warehouse/OSGiWarehouseComponentImpl.java | 47 ++ .../supplychain/warehouse/OSGiWarehouseImpl.java | 44 ++ .../main/java/supplychain/warehouse/Warehouse.java | 28 + .../src/main/resources/Customer.componentType | 28 + .../src/main/resources/DSCustomer.componentType | 28 + .../src/main/resources/DSRetailer.componentType | 28 + .../src/main/resources/DSShipper.componentType | 28 + .../src/main/resources/DSWarehouse.componentType | 28 + .../src/main/resources/Retailer.componentType | 28 + .../src/main/resources/Shipper.componentType | 28 + .../src/main/resources/Warehouse.componentType | 28 + .../src/main/resources/osgi/Customer.mf | 11 + .../src/main/resources/osgi/Retailer.mf | 10 + .../src/main/resources/osgi/Shipper.mf | 10 + .../src/main/resources/osgi/Warehouse.mf | 10 + .../src/main/resources/osgi/ds/Customer.mf | 10 + .../src/main/resources/osgi/ds/Customer.xml | 32 + .../src/main/resources/osgi/ds/Retailer.mf | 11 + .../src/main/resources/osgi/ds/Retailer.xml | 32 + .../src/main/resources/osgi/ds/Shipper.mf | 10 + .../src/main/resources/osgi/ds/Shipper.xml | 33 ++ .../src/main/resources/osgi/ds/Warehouse.mf | 11 + .../src/main/resources/osgi/ds/Warehouse.xml | 32 + .../src/main/resources/supplychain.composite | 61 ++ .../src/main/resources/supplychain.ds.composite | 61 ++ .../supplychain/SupplyChainClientTestCase.java | 60 ++ java/sca/contrib/samples/photo-gallery/README | 28 + java/sca/contrib/samples/photo-gallery/build.xml | 79 +++ .../samples/photo-gallery/photo-gallery.png | Bin 0 -> 15670 bytes .../samples/photo-gallery/photo-gallery.svg | 304 ++++++++++ java/sca/contrib/samples/photo-gallery/pom.xml | 148 +++++ .../src/main/java/launch/LaunchGallery.java | 34 ++ .../src/main/java/launch/LaunchGalleryJCR.java | 34 ++ .../src/main/java/services/Album.java | 29 + .../src/main/java/services/AlbumImpl.java | 95 +++ .../src/main/java/services/jcr/AlbumImpl.java | 159 +++++ .../photo-gallery/src/main/resources/gallery.html | 135 +++++ .../src/main/resources/gallery/boston/dsc00368.jpg | Bin 0 -> 32808 bytes .../src/main/resources/gallery/boston/dsc00369.jpg | Bin 0 -> 35980 bytes .../src/main/resources/gallery/boston/dsc00370.jpg | Bin 0 -> 44614 bytes .../src/main/resources/gallery/boston/dsc00371.jpg | Bin 0 -> 40745 bytes .../src/main/resources/gallery/boston/dsc00373.jpg | Bin 0 -> 76470 bytes .../src/main/resources/gallery/boston/dsc00375.jpg | Bin 0 -> 34834 bytes .../src/main/resources/gallery/boston/dsc00376.jpg | Bin 0 -> 38797 bytes .../src/main/resources/gallery/boston/dsc00377.jpg | Bin 0 -> 35776 bytes .../src/main/resources/gallery/boston/dsc00378.jpg | Bin 0 -> 35248 bytes .../src/main/resources/gallery/boston/dsc00379.jpg | Bin 0 -> 55042 bytes .../src/main/resources/gallery/boston/dsc00380.jpg | Bin 0 -> 55236 bytes .../photo-gallery/src/main/resources/index.gif | Bin 0 -> 564 bytes .../photo-gallery/src/main/resources/index_on.gif | Bin 0 -> 577 bytes .../photo-gallery/src/main/resources/next.gif | Bin 0 -> 535 bytes .../src/main/resources/next_disabled.gif | Bin 0 -> 536 bytes .../photo-gallery/src/main/resources/next_on.gif | Bin 0 -> 542 bytes .../src/main/resources/photo-gallery-jcr.composite | 47 ++ .../src/main/resources/photo-gallery.composite | 47 ++ .../photo-gallery/src/main/resources/prev.gif | Bin 0 -> 534 bytes .../src/main/resources/prev_disabled.gif | Bin 0 -> 536 bytes .../photo-gallery/src/main/resources/prev_on.gif | Bin 0 -> 541 bytes .../src/main/resources/show_slide.gif | Bin 0 -> 533 bytes .../photo-gallery/src/main/resources/space.gif | Bin 0 -> 116 bytes .../photo-gallery/src/main/resources/styles.css | 121 ++++ java/sca/contrib/samples/quote-xquery/README | 450 ++++++++++++++ java/sca/contrib/samples/quote-xquery/build.xml | 120 ++++ java/sca/contrib/samples/quote-xquery/pom.xml | 184 ++++++ .../java/xquery/quote/AvailQuoteProviderImpl.java | 30 + .../xquery/quote/AvailQuoteProviderNodeInfo.java | 28 + .../xquery/quote/AvailQuoteProviderService.java | 27 + .../xquery/quote/ExternalReferencesQuoteJoin.java | 27 + .../main/java/xquery/quote/PriceQuoteProvider.java | 28 + .../java/xquery/quote/PriceQuoteProviderImpl.java | 27 + .../xquery/quote/PriceQuoteProviderNodeInfo.java | 28 + .../java/xquery/quote/PropertiesQuoteJoin.java | 32 + .../main/java/xquery/quote/QuoteCalculator.java | 26 + .../java/xquery/quote/QuoteCalculatorImpl.java | 38 ++ .../src/main/java/xquery/quote/QuoteDataUtil.java | 107 ++++ .../src/main/java/xquery/quote/QuoteJoin.java | 34 ++ .../src/main/java/xquery/quote/QuoteJoinLocal.java | 34 ++ .../main/java/xquery/quote/QuoteJoinLocalImpl.java | 67 +++ .../main/java/xquery/quote/XQueryQuoteClient.java | 145 +++++ .../main/java/xquery/quote/XQueryQuoteServer.java | 39 ++ .../src/main/resources/META-INF/sca/quote_join.xq | 61 ++ .../META-INF/sca/quote_join_external_references.xq | 69 +++ .../META-INF/sca/quote_join_properties.xq | 74 +++ .../src/main/resources/wsdl/AvailQuote.xsd | 39 ++ .../src/main/resources/wsdl/PriceQuote.xsd | 49 ++ .../quote-xquery/src/main/resources/wsdl/Quote.xsd | 40 ++ .../src/main/resources/wsdl/quotejoin.wsdl | 137 +++++ .../src/main/resources/xqueryquotews.composite | 55 ++ .../main/resources/xqueryquotewsclient.composite | 113 ++++ .../xquery/quote/XQueryQuoteClientTestCase.java | 192 ++++++ .../java/xquery/quote/XQueryQuoteTestServer.java | 50 ++ .../contrib/samples/simple-bigbank-spring/README | 148 +++++ .../samples/simple-bigbank-spring/build-dojo.xml | 92 +++ .../samples/simple-bigbank-spring/build.xml | 72 +++ .../contrib/samples/simple-bigbank-spring/pom.xml | 277 +++++++++ .../simple-bigbank-spring.png | Bin 0 -> 10202 bytes .../simple-bigbank-spring.svg | 200 +++++++ .../main/java/bigbank/account/AccountReport.java | 43 ++ .../main/java/bigbank/account/AccountService.java | 26 + .../java/bigbank/account/AccountServiceImpl.java | 145 +++++ .../account/checking/CheckingAccountDetails.java | 45 ++ .../account/checking/CheckingAccountService.java | 34 ++ .../java/bigbank/account/feed/AccountFeedImpl.java | 71 +++ .../account/savings/SavingsAccountDetails.java | 47 ++ .../account/savings/SavingsAccountService.java | 32 + .../account/savings/SavingsAccountServiceImpl.java | 62 ++ .../bigbank/account/stock/StockAccountDetails.java | 63 ++ .../bigbank/account/stock/StockAccountService.java | 33 ++ .../account/stock/StockAccountServiceImpl.java | 56 ++ .../java/bigbank/calculator/CalculatorService.java | 34 ++ .../main/java/bigbank/client/BigBankClient.java | 46 ++ .../main/java/bigbank/server/BigBankServer.java | 54 ++ .../java/bigbank/stockquote/StockQuoteService.java | 31 + .../src/main/resources/BigBank.composite | 88 +++ .../src/main/resources/SavingsAccount.composite | 32 + .../src/main/resources/StockAccount.composite | 32 + .../spring-context/Account-spring-context.xml | 53 ++ .../spring-context/SavingsAccount-context.xml | 33 ++ .../StockAccount/META-INF/MANIFEST.MF | 4 + .../META-INF/spring/StockAccount-context.xml | 33 ++ .../src/main/resources/web/style.css | 22 + .../src/test/java/bigbank/BigBankTestCase.java | 34 ++ java/sca/contrib/samples/simple-bigbank/README | 101 ++++ java/sca/contrib/samples/simple-bigbank/build.xml | 72 +++ java/sca/contrib/samples/simple-bigbank/pom.xml | 65 ++ .../samples/simple-bigbank/simple-bigbank.png | Bin 0 -> 10202 bytes .../samples/simple-bigbank/simple-bigbank.svg | 200 +++++++ .../main/java/bigbank/account/AccountReport.java | 43 ++ .../main/java/bigbank/account/AccountService.java | 26 + .../java/bigbank/account/AccountServiceImpl.java | 68 +++ .../src/main/java/bigbank/accountdata/Account.java | 26 + .../bigbank/accountdata/AccountDataService.java | 28 + .../accountdata/AccountDataServiceImpl.java | 54 ++ .../java/bigbank/accountdata/CheckingAccount.java | 35 ++ .../java/bigbank/accountdata/SavingsAccount.java | 35 ++ .../java/bigbank/accountdata/StockAccount.java | 43 ++ .../main/java/bigbank/client/BigBankClient.java | 43 ++ .../java/bigbank/stockquote/StockQuoteImpl.java | 36 ++ .../java/bigbank/stockquote/StockQuoteService.java | 32 + .../src/main/resources/Account.composite | 38 ++ .../src/main/resources/BigBank.composite | 35 ++ .../src/main/resources/StockQuote.composite | 31 + .../src/test/java/bigbank/BigBankTestCase.java | 50 ++ java/sca/contrib/samples/simple-callback-ws/README | 144 +++++ .../contrib/samples/simple-callback-ws/build.xml | 72 +++ .../sca/contrib/samples/simple-callback-ws/pom.xml | 79 +++ .../simple-callback-ws/simple-callback-ws.png | Bin 0 -> 137 bytes .../simple-callback-ws/simple-callback-ws.svg | 150 +++++ .../src/main/java/simplecallback/MyClient.java | 27 + .../src/main/java/simplecallback/MyClientImpl.java | 51 ++ .../src/main/java/simplecallback/MyService.java | 34 ++ .../java/simplecallback/MyServiceCallback.java | 30 + .../main/java/simplecallback/MyServiceImpl.java | 54 ++ .../java/simplecallback/SimpleCallbackClient.java | 38 ++ .../src/main/resources/simplecallback.composite | 49 ++ .../src/main/resources/wsdl/simplecallback.wsdl | 109 ++++ .../simplecallback/SimpleCallbackTestCase.java | 53 ++ java/sca/contrib/samples/simple-callback/README | 97 +++ java/sca/contrib/samples/simple-callback/build.xml | 72 +++ java/sca/contrib/samples/simple-callback/pom.xml | 65 ++ .../samples/simple-callback/simple-callback.png | Bin 0 -> 137 bytes .../samples/simple-callback/simple-callback.svg | 150 +++++ .../src/main/java/simplecallback/MyClient.java | 27 + .../src/main/java/simplecallback/MyClientImpl.java | 49 ++ .../src/main/java/simplecallback/MyService.java | 32 + .../java/simplecallback/MyServiceCallback.java | 27 + .../main/java/simplecallback/MyServiceImpl.java | 51 ++ .../java/simplecallback/SimpleCallbackClient.java | 38 ++ .../src/main/resources/simplecallback.composite | 34 ++ .../simplecallback/SimpleCallbackTestCase.java | 51 ++ .../samples/spi-implementation-pojo/pom.xml | 59 ++ .../src/main/java/sample/JavaImplementation.java | 35 ++ .../java/sample/JavaImplementationActivator.java | 37 ++ .../src/main/java/sample/JavaInvoker.java | 59 ++ .../src/main/java/sample/JavaInvokerFactory.java | 47 ++ ....apache.tuscany.sca.spi.ImplementationActivator | 18 + .../src/test/java/helloworld/HelloWorld.java | 26 + .../src/test/java/helloworld/HelloWorldImpl.java | 28 + .../test/java/helloworld/HelloWorldTestCase.java | 35 ++ .../test/resources/helloworld/helloworld.composite | 28 + .../samples/spring-bigbank-calculator/README | 2 + .../samples/spring-bigbank-calculator/build.xml | 72 +++ .../samples/spring-bigbank-calculator/pom.xml | 110 ++++ .../main/java/bigbank/calculator/AddService.java | 25 + .../java/bigbank/calculator/CalculatorService.java | 34 ++ .../bigbank/calculator/CalculatorServiceImpl.java | 72 +++ .../java/bigbank/calculator/DivideService.java | 25 + .../java/bigbank/calculator/MultiplyService.java | 25 + .../java/bigbank/calculator/SubtractService.java | 25 + .../calculator/server/CalculatorServer.java | 50 ++ .../src/main/resources/Calculator.composite | 56 ++ .../META-INF/spring/CalculatorService-context.xml | 45 ++ .../main/resources/calculator/AddServiceImpl.js | 22 + .../resources/calculator/DivideServiceImpl.groovy | 22 + .../resources/calculator/MultiplyServiceImpl.py | 21 + .../resources/calculator/SubtractServiceImpl.rb | 22 + .../calculator/CalculatorServiceTestCase.java | 33 ++ .../samples/spring-bigbank-checkaccount/README | 4 + .../samples/spring-bigbank-checkaccount/build.xml | 73 +++ .../samples/spring-bigbank-checkaccount/pom.xml | 133 +++++ .../account/checking/CheckingAccountDetails.java | 50 ++ .../account/checking/CheckingAccountService.java | 37 ++ .../checking/CheckingAccountServiceImpl.java | 66 +++ .../checking/server/CheckingAccountServer.java | 70 +++ .../AccountsDataPasswordCallbackHandler.java | 54 ++ .../account/security/BigbankCheckingsAcl.java | 48 ++ ...ckingsDeptAuthImplementationPolicyProvider.java | 90 +++ .../account/security/CheckingsDeptAuthPolicy.java | 46 ++ .../CheckingsDeptAuthPolicyInterceptor.java | 73 +++ .../CheckingsDeptAuthPolicyProviderFactory.java | 75 +++ .../CheckingsDeptAuthorizationPolicyHandler.java | 67 +++ .../CheckingsDeptAuthorizationPolicyProcessor.java | 72 +++ .../src/main/resources/CheckingsAccount.composite | 41 ++ ...ca.contribution.processor.StAXArtifactProcessor | 19 + ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 20 + ...ache.tuscany.sca.provider.PolicyProviderFactory | 19 + .../src/main/resources/definitions.xml | 58 ++ .../spring/CheckingAccountService-context.xml | 33 ++ .../checkaccount/CheckAccountServiceTestCase.java | 33 ++ .../samples/spring-bigbank-stockquote/README | 4 + .../samples/spring-bigbank-stockquote/build.xml | 73 +++ .../samples/spring-bigbank-stockquote/pom.xml | 110 ++++ .../java/bigbank/stockquote/StockQuoteImpl.java | 38 ++ .../java/bigbank/stockquote/StockQuoteService.java | 30 + .../server/SCAApplicationContextProvider.java | 19 + .../stockquote/server/StockQuoteServer.java | 58 ++ .../META-INF/spring/StockQuoteService-context.xml | 36 ++ .../src/main/resources/StockQuote.composite | 35 ++ .../stockquote/StockQuoteServiceTestCase.java | 33 ++ java/sca/contrib/samples/store-distributed/README | 28 + .../contrib/samples/store-distributed/build.xml | 79 +++ .../samples/store-distributed/cloud.composite | 27 + .../samples/store-distributed/domain.composite | 27 + java/sca/contrib/samples/store-distributed/pom.xml | 119 ++++ .../src/main/java/node/LaunchDomain.java | 33 ++ .../src/main/java/node/LaunchStoreNodeA.java | 28 + .../src/main/java/node/LaunchStoreNodeB.java | 28 + .../src/main/java/node/LaunchStoreNodeC.java | 28 + .../src/main/java/services/Cart.java | 28 + .../src/main/java/services/Catalog.java | 27 + .../src/main/java/services/CurrencyConverter.java | 29 + .../main/java/services/CurrencyConverterImpl.java | 38 ++ .../src/main/java/services/FruitsCatalogImpl.java | 52 ++ .../src/main/java/services/Item.java | 51 ++ .../src/main/java/services/ShoppingCartImpl.java | 112 ++++ .../src/main/java/services/Total.java | 29 + .../src/main/resources/cloud/NodeA.composite | 36 ++ .../src/main/resources/cloud/NodeB.composite | 36 ++ .../src/main/resources/cloud/NodeC.composite | 36 ++ .../resources/nodeA/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeA/store.composite | 38 ++ .../resources/nodeB/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeB/store.composite | 35 ++ .../resources/nodeC/META-INF/sca-contribution.xml | 24 + .../src/main/resources/nodeC/store.composite | 41 ++ .../src/main/resources/nodeC/uiservices/store.html | 162 +++++ .../src/main/resources/uiservices/store.html | 162 +++++ .../contrib/samples/store-distributed/store.png | Bin 0 -> 15670 bytes .../contrib/samples/store-distributed/store.svg | 304 ++++++++++ .../samples/store-distributed/workspace.xml | 25 + java/sca/contrib/samples/store/README | 28 + java/sca/contrib/samples/store/build.xml | 79 +++ java/sca/contrib/samples/store/pom.xml | 106 ++++ .../samples/store/src/main/java/launch/Launch.java | 34 ++ .../samples/store/src/main/java/services/Cart.java | 28 + .../store/src/main/java/services/Catalog.java | 27 + .../src/main/java/services/CurrencyConverter.java | 29 + .../main/java/services/CurrencyConverterImpl.java | 38 ++ .../src/main/java/services/FruitsCatalogImpl.java | 52 ++ .../samples/store/src/main/java/services/Item.java | 51 ++ .../src/main/java/services/ShoppingCartImpl.java | 112 ++++ .../store/src/main/java/services/Total.java | 29 + .../store/src/main/resources/store.composite | 64 ++ .../store/src/main/resources/uiservices/store.html | 162 +++++ java/sca/contrib/samples/store/store.png | Bin 0 -> 15670 bytes java/sca/contrib/samples/store/store.svg | 304 ++++++++++ java/sca/contrib/samples/supplychain/README | 101 ++++ java/sca/contrib/samples/supplychain/build.xml | 72 +++ java/sca/contrib/samples/supplychain/pom.xml | 65 ++ .../src/main/java/supplychain/Customer.java | 33 ++ .../java/supplychain/CustomerComponentImpl.java | 44 ++ .../src/main/java/supplychain/Retailer.java | 28 + .../java/supplychain/RetailerComponentImpl.java | 39 ++ .../src/main/java/supplychain/Shipper.java | 28 + .../java/supplychain/ShipperComponentImpl.java | 39 ++ .../main/java/supplychain/SupplyChainClient.java | 40 ++ .../src/main/java/supplychain/Warehouse.java | 28 + .../java/supplychain/WarehouseComponentImpl.java | 39 ++ .../src/main/resources/supplychain.composite | 45 ++ .../supplychain/SupplyChainClientTestCase.java | 52 ++ .../contrib/samples/supplychain/supplychain.png | Bin 0 -> 3898 bytes .../contrib/samples/supplychain/supplychain.svg | 228 +++++++ java/sca/contrib/samples/web-resource/README | 76 +++ java/sca/contrib/samples/web-resource/build.xml | 72 +++ java/sca/contrib/samples/web-resource/pom.xml | 79 +++ .../src/main/java/web/resource/SampleServer.java | 44 ++ .../src/main/resources/WebResource.composite | 32 + .../src/main/resources/myContent/index.html | 49 ++ .../contrib/samples/web-resource/web-resource.png | Bin 0 -> 8418 bytes .../contrib/samples/web-resource/web-resource.svg | 197 ++++++ java/sca/contrib/samples/zipcode-jaxws/LICENSE | 205 +++++++ java/sca/contrib/samples/zipcode-jaxws/NOTICE | 6 + java/sca/contrib/samples/zipcode-jaxws/README | 72 +++ java/sca/contrib/samples/zipcode-jaxws/build.xml | 68 +++ java/sca/contrib/samples/zipcode-jaxws/pom.xml | 245 ++++++++ .../java/com/example/uszip/GetInfoByAreaCode.java | 81 +++ .../example/uszip/GetInfoByAreaCodeResponse.java | 158 +++++ .../main/java/com/example/uszip/GetInfoByCity.java | 81 +++ .../com/example/uszip/GetInfoByCityResponse.java | 158 +++++ .../java/com/example/uszip/GetInfoByState.java | 81 +++ .../com/example/uszip/GetInfoByStateResponse.java | 158 +++++ .../main/java/com/example/uszip/GetInfoByZIP.java | 81 +++ .../com/example/uszip/GetInfoByZIPResponse.java | 158 +++++ .../main/java/com/example/uszip/ObjectFactory.java | 145 +++++ .../src/main/java/com/example/uszip/USZip.java | 89 +++ .../src/main/java/com/example/uszip/USZipSoap.java | 103 ++++ .../main/java/com/example/uszip/package-info.java | 20 + .../com/example/weather/ArrayOfWeatherData.java | 87 +++ .../com/example/weather/GetWeatherByPlaceName.java | 81 +++ .../weather/GetWeatherByPlaceNameResponse.java | 81 +++ .../com/example/weather/GetWeatherByZipCode.java | 81 +++ .../weather/GetWeatherByZipCodeResponse.java | 81 +++ .../java/com/example/weather/ObjectFactory.java | 118 ++++ .../main/java/com/example/weather/WeatherData.java | 219 +++++++ .../java/com/example/weather/WeatherForecast.java | 91 +++ .../com/example/weather/WeatherForecastSoap.java | 73 +++ .../java/com/example/weather/WeatherForecasts.java | 251 ++++++++ .../java/com/example/weather/package-info.java | 20 + .../src/main/java/location/LocationClient.java | 55 ++ .../src/main/java/location/USLocationImpl.java | 56 ++ .../main/java/weather/WeatherForecastClient.java | 60 ++ .../src/main/java/weather/WeatherForecastImpl.java | 43 ++ .../src/main/java/zipcode/ZipCodeClient.java | 38 ++ .../src/main/java/zipcode/ZipCodeService.java | 30 + .../src/main/java/zipcode/ZipCodeServiceImpl.java | 82 +++ .../src/main/resources/USLocation.composite | 30 + .../src/main/resources/WeatherForecast.composite | 30 + .../src/main/resources/ZipCode.composite | 33 ++ .../test/java/zipcode/ZipCodeClientTestCase.java | 51 ++ java/sca/samples/binding-echo-extension/README | 74 --- java/sca/samples/binding-echo-extension/build.xml | 51 -- java/sca/samples/binding-echo-extension/pom.xml | 78 --- .../src/main/java/echo/EchoBinding.java | 29 - .../src/main/java/echo/EchoBindingFactory.java | 33 -- .../java/echo/impl/EchoBindingFactoryImpl.java | 34 -- .../src/main/java/echo/impl/EchoBindingImpl.java | 104 ---- .../main/java/echo/impl/EchoBindingProcessor.java | 128 ---- .../java/echo/provider/EchoBindingInvoker.java | 48 -- .../echo/provider/EchoBindingPoliciedInvoker.java | 71 --- .../echo/provider/EchoBindingProviderFactory.java | 58 -- .../provider/EchoReferenceBindingProvider.java | 71 --- .../echo/provider/EchoServiceBindingProvider.java | 78 --- .../policy/EchoBindingEncryptionPolicy.java | 41 -- .../EchoBindingEncryptionPolicyProcessor.java | 37 -- .../echo/provider/policy/EchoBindingPolicy.java | 43 -- .../policy/EchoBindingPolicyProcessor.java | 78 --- .../provider/policy/EncryptionPolicyHandler.java | 48 -- .../echo/provider/policy/EncryptionStrategy.java | 26 - .../java/echo/provider/policy/PolicyHandler.java | 29 - .../provider/policy/ReverseEncryptionStrategy.java | 33 -- .../main/java/echo/provider/policy/WSPolicy.java | 43 -- .../echo/provider/policy/WSPolicyProcessor.java | 54 -- .../src/main/java/echo/server/EchoServer.java | 78 --- .../main/java/echo/server/EchoServiceListener.java | 52 -- .../META-INF/services/echo.EchoBindingFactory | 19 - ...ca.contribution.processor.StAXArtifactProcessor | 21 - ...any.sca.contribution.processor.ValidationSchema | 19 - ...che.tuscany.sca.provider.BindingProviderFactory | 19 - .../src/main/resources/sample-binding-echo.xsd | 36 -- .../src/test/java/echo/Echo.java | 29 - .../src/test/java/echo/EchoComponentImpl.java | 44 -- .../src/test/java/echo/EchoReferenceTestCase.java | 50 -- .../src/test/java/echo/EchoServiceTestCase.java | 50 -- .../src/test/resources/EchoBinding.composite | 43 -- .../src/test/resources/definitions.xml | 39 -- java/sca/samples/binding-echo/README | 104 ---- java/sca/samples/binding-echo/binding-echo.png | Bin 7846 -> 0 bytes java/sca/samples/binding-echo/binding-echo.svg | 174 ------ java/sca/samples/binding-echo/build.xml | 75 --- java/sca/samples/binding-echo/pom.xml | 71 --- .../binding-echo/src/main/java/echo/Echo.java | 29 - .../src/main/java/echo/EchoBindingClient.java | 51 -- .../src/main/java/echo/EchoComponentImpl.java | 44 -- .../src/main/resources/EchoBinding.composite | 40 -- .../src/test/java/echo/EchoBindingTestCase.java | 57 -- .../sca/samples/binding-notification-broker/README | 112 ---- .../binding-notification-broker.png | Bin 36945 -> 0 bytes .../samples/binding-notification-broker/build.xml | 75 --- .../samples/binding-notification-broker/pom.xml | 98 --- .../java/notification/broker/TestCaseProducer.java | 24 - .../java/notification/broker/TrafficAdvisory.java | 30 - .../broker/TrafficAdvisoryConsumer.java | 41 -- .../broker/TrafficAdvisoryProducer.java | 36 -- .../notification/broker/TrafficAdvisoryServer.java | 72 --- .../TrafficAdvisoryNotification.componentType | 34 -- .../TrafficAdvisoryNotification.composite | 61 -- .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 -- .../samples/binding-notification-consumer/README | 109 ---- .../binding-notification-consumer.png | Bin 27279 -> 0 bytes .../binding-notification-consumer/build.xml | 75 --- .../samples/binding-notification-consumer/pom.xml | 116 ---- .../notification/consumer/TrafficAdvisory.java | 30 - .../consumer/TrafficAdvisoryConsumer.java | 41 -- .../consumer/TrafficAdvisoryServer.java | 48 -- .../TrafficAdvisoryNotification.componentType | 34 -- .../TrafficAdvisoryNotification.composite | 53 -- .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 -- .../consumer/TrafficAdvisoryTestCase.java | 61 -- .../samples/binding-notification-producer/README | 133 ----- .../binding-notification-producer.png | Bin 21631 -> 0 bytes .../binding-notification-producer/build.xml | 75 --- .../samples/binding-notification-producer/pom.xml | 127 ---- .../notification/producer/TestCaseProducer.java | 24 - .../notification/producer/TrafficAdvisory.java | 30 - .../producer/TrafficAdvisoryProducer.java | 36 -- .../producer/TrafficAdvisoryServer.java | 57 -- .../TrafficAdvisoryNotification.componentType | 34 -- .../TrafficAdvisoryNotification.composite | 44 -- .../src/main/resources/wsdl/TrafficAdvisory.wsdl | 50 -- .../producer/TrafficAdvisoryTestCase.java | 78 --- java/sca/samples/calculator-corba-reference/README | 83 --- .../sca/samples/calculator-corba-reference/pom.xml | 74 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/CalculatorClient.java | 44 -- .../main/java/calculator/CalculatorService.java | 39 -- .../java/calculator/CalculatorServiceImpl.java | 68 --- .../src/main/java/calculator/DivideService.java | 28 - .../src/main/java/calculator/MultiplyService.java | 28 - .../src/main/java/calculator/SubtractService.java | 28 - .../resources/CalculatorCORBAReference.composite | 42 -- .../CalculatorCORBAReferenceTestCase.java | 82 --- .../java/calculator/CalculatorCORBAServant.java | 44 -- .../calculator/idl/CalculatorCORBAService.java | 32 - .../idl/CalculatorCORBAServiceOperations.java | 36 -- .../idl/_CalculatorCORBAServiceImplBase.java | 120 ---- .../src/test/resources/CalculatorCORBA.idl | 33 -- java/sca/samples/calculator-corba-service/README | 82 --- java/sca/samples/calculator-corba-service/pom.xml | 74 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 30 - .../main/java/calculator/CalculatorService.java | 36 -- .../java/calculator/CalculatorServiceImpl.java | 68 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 30 - .../main/resources/CalculatorCORBAServer.composite | 53 -- .../calculator/CalculatorCORBAServerTestCase.java | 64 -- .../calculator/idl/CalculatorCORBAService.java | 32 - .../idl/CalculatorCORBAServiceHelper.java | 104 ---- .../idl/CalculatorCORBAServiceHolder.java | 57 -- .../idl/CalculatorCORBAServiceOperations.java | 36 -- .../idl/_CalculatorCORBAServiceStub.java | 143 ----- .../src/test/resources/CalculatorCORBA.idl | 33 -- java/sca/samples/calculator-distributed/README | 438 -------------- java/sca/samples/calculator-distributed/build.xml | 111 ---- .../calculator-distributed.png | Bin 76839 -> 0 bytes .../calculator-distributed.svg | 383 ------------ .../samples/calculator-distributed/cloud.composite | 26 - .../calculator-distributed/domain.composite | 26 - java/sca/samples/calculator-distributed/pom.xml | 119 ---- .../src/main/java/calculator/AddService.java | 31 - .../src/main/java/calculator/AddServiceImpl.java | 31 - .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 74 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 31 - .../main/java/calculator/SubtractServiceImpl.java | 31 - .../src/main/java/node/LaunchCalculatorNodeA.java | 67 --- .../src/main/java/node/LaunchCalculatorNodeB.java | 28 - .../src/main/java/node/LaunchCalculatorNodeC.java | 28 - .../src/main/java/node/LaunchDomain.java | 33 -- .../src/main/resources/cloud/NodeA.composite | 33 -- .../src/main/resources/cloud/NodeB.composite | 33 -- .../src/main/resources/cloud/NodeC.composite | 33 -- .../src/main/resources/nodeA/Calculator.composite | 41 -- .../resources/nodeA/META-INF/sca-contribution.xml | 24 - .../src/main/resources/nodeB/Calculator.composite | 29 - .../resources/nodeB/META-INF/sca-contribution.xml | 24 - .../src/main/resources/nodeC/Calculator.composite | 29 - .../resources/nodeC/META-INF/sca-contribution.xml | 24 - .../calculator/CalculatorDistributedTestCase.java | 92 --- .../samples/calculator-distributed/workspace.xml | 25 - java/sca/samples/calculator-equinox/README | 97 --- java/sca/samples/calculator-equinox/build.xml | 74 --- java/sca/samples/calculator-equinox/calculator.png | Bin 20552 -> 0 bytes java/sca/samples/calculator-equinox/calculator.svg | 329 ----------- java/sca/samples/calculator-equinox/pom.xml | 91 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 62 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 70 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 35 -- .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 35 -- .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 35 -- .../src/main/resources/Calculator.composite | 54 -- .../test/java/calculator/CalculatorTestCase.java | 65 -- .../calculator-implementation-policies/README | 266 --------- .../calculator-implementation-policies/build.xml | 72 --- .../calculator.png | Bin 20552 -> 0 bytes .../calculator.svg | 329 ----------- .../calculator-implementation-policies/pom.xml | 78 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 66 --- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 70 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 35 -- .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 35 -- .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 35 -- .../security/CalculatorCallbackHandler.java | 50 -- .../java/calculator/security/JaasLoginModule.java | 178 ------ .../java/calculator/security/UserPrincipal.java | 66 --- .../src/main/resources/Calculator.composite | 61 -- .../src/main/resources/CalculatorJass.config | 3 - .../resources/CalculatorLogMessages.properties | 18 - .../src/main/resources/definitions.xml | 40 -- .../test/java/calculator/CalculatorTestCase.java | 74 --- java/sca/samples/calculator-lean/README | 87 --- java/sca/samples/calculator-lean/calculator.png | Bin 20552 -> 0 bytes java/sca/samples/calculator-lean/calculator.svg | 329 ----------- java/sca/samples/calculator-lean/pom.xml | 71 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 51 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 70 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 35 -- .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 35 -- .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 35 -- .../src/main/resources/Calculator.composite | 54 -- .../src/main/resources/CalculatorTest.composite | 32 - .../test/java/calculator/CalculatorTestCase.java | 62 -- java/sca/samples/calculator-rcp/build.properties | 5 - .../samples/calculator-rcp/icons/alt_window_16.gif | Bin 637 -> 0 bytes .../samples/calculator-rcp/icons/alt_window_32.gif | Bin 1192 -> 0 bytes java/sca/samples/calculator-rcp/plugin.xml | 31 - java/sca/samples/calculator-rcp/pom.xml | 126 ---- .../src/main/java/Calculator.composite | 54 -- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 52 -- .../main/java/calculator/CalculatorService.java | 34 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 35 -- .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 35 -- .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 35 -- .../src/main/java/calculator/rcp/Activator.java | 94 --- .../src/main/java/calculator/rcp/Application.java | 63 -- .../rcp/ApplicationActionBarAdvisor.java | 65 -- .../rcp/ApplicationWorkbenchAdvisor.java | 37 -- .../rcp/ApplicationWorkbenchWindowAdvisor.java | 44 -- .../src/main/java/calculator/rcp/Perspective.java | 34 -- .../src/main/java/calculator/rcp/View.java | 88 --- java/sca/samples/calculator-script/README | 105 ---- java/sca/samples/calculator-script/build.xml | 72 --- .../calculator-script/calculator-script.png | Bin 23064 -> 0 bytes .../calculator-script/calculator-script.svg | 334 ----------- java/sca/samples/calculator-script/pom.xml | 78 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/CalculatorClient.java | 43 -- .../main/java/calculator/CalculatorService.java | 34 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../src/main/java/calculator/MultiplyService.java | 28 - .../src/main/java/calculator/SubtractService.java | 28 - .../src/main/resources/Calculator.composite | 50 -- .../main/resources/calculator/AddServiceImpl.js | 22 - .../resources/calculator/DivideServiceImpl.groovy | 22 - .../resources/calculator/MultiplyServiceImpl.py | 20 - .../resources/calculator/SubtractServiceImpl.rb | 21 - .../test/java/calculator/CalculatorTestCase.java | 52 -- java/sca/samples/calculator-webapp/README | 118 ---- .../samples/calculator-webapp/calculator-web.png | Bin 22916 -> 0 bytes .../samples/calculator-webapp/calculator-web.svg | 358 ----------- java/sca/samples/calculator-webapp/pom.xml | 72 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 30 - .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 30 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 32 - .../src/main/webapp/WEB-INF/web.composite | 49 -- .../src/main/webapp/WEB-INF/web.xml | 41 -- .../calculator-webapp/src/main/webapp/calc.jsp | 47 -- .../sca/samples/calculator-ws-secure-webapp/README | 116 ---- .../calculator-ws-secure-webapp/calculator-web.png | Bin 25757 -> 0 bytes .../calculator-ws-secure-webapp/calculator-web.svg | 455 -------------- .../samples/calculator-ws-secure-webapp/pom.xml | 102 ---- .../src/main/java/calculator/AddService.java | 31 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 47 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 31 - .../main/java/calculator/SubtractServiceImpl.java | 30 - .../calculator/security/ClientPWCBHandler.java | 58 -- .../calculator/security/ServerPWCBHandler.java | 59 -- .../src/main/resources/Calculator.composite | 67 --- ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 21 - .../src/main/resources/calculatorKeys.jks | Bin 2706 -> 0 bytes .../src/main/resources/definitions.xml | 198 ------- .../src/main/resources/security.properties | 20 - .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 33 -- .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/calc.jsp | 50 -- java/sca/samples/calculator-ws-webapp/README | 108 ---- .../calculator-ws-webapp/calculator-web.png | Bin 25757 -> 0 bytes .../calculator-ws-webapp/calculator-web.svg | 455 -------------- java/sca/samples/calculator-ws-webapp/pom.xml | 102 ---- .../src/main/java/calculator/AddService.java | 31 - .../src/main/java/calculator/AddServiceImpl.java | 34 -- .../src/main/java/calculator/CalculatorClient.java | 47 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 30 - .../src/main/resources/Calculator.composite | 56 -- .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 -- .../src/main/webapp/WEB-INF/web.xml | 41 -- .../calculator-ws-webapp/src/main/webapp/calc.jsp | 50 -- java/sca/samples/calculator2/README | 97 --- java/sca/samples/calculator2/build.xml | 72 --- java/sca/samples/calculator2/calculator.png | Bin 20552 -> 0 bytes java/sca/samples/calculator2/calculator.svg | 329 ----------- java/sca/samples/calculator2/pom.xml | 65 -- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 45 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 70 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 35 -- .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 35 -- .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 35 -- .../src/main/resources/Calculator.composite | 49 -- .../test/java/calculator/CalculatorTestCase.java | 51 -- java/sca/samples/callback-ws-client/README | 311 ---------- java/sca/samples/callback-ws-client/build.xml | 73 --- .../callback-ws-client/callback-ws-client.png | Bin 8812 -> 0 bytes .../callback-ws-client/callback-ws-client.svg | 204 ------- java/sca/samples/callback-ws-client/pom.xml | 86 --- .../src/main/java/myapp/MyClient.java | 29 - .../src/main/java/myapp/MyClientImpl.java | 64 -- .../src/main/java/myserver/MyService.java | 34 -- .../src/main/java/myserver/MyServiceCallback.java | 30 - .../main/resources/META-INF/sca-contribution.xml | 22 - .../src/main/resources/myapp.composite | 36 -- .../test/java/myapp/CallbackClientTestCase.java | 53 -- java/sca/samples/callback-ws-service/README | 227 ------- java/sca/samples/callback-ws-service/build.xml | 73 --- .../callback-ws-service/callback-ws-service.png | Bin 8949 -> 0 bytes .../callback-ws-service/callback-ws-service.svg | 200 ------- java/sca/samples/callback-ws-service/pom.xml | 79 --- .../src/main/java/myserver/CallbackServer.java | 48 -- .../src/main/java/myserver/MyService.java | 34 -- .../src/main/java/myserver/MyServiceCallback.java | 30 - .../src/main/java/myserver/MyServiceImpl.java | 56 -- .../main/resources/META-INF/sca-contribution.xml | 24 - .../src/main/resources/callbackws.composite | 35 -- .../test/java/myserver/CallbackServerTestCase.java | 52 -- java/sca/samples/callbacks-jms/README | 73 --- java/sca/samples/callbacks-jms/build.xml | 72 --- java/sca/samples/callbacks-jms/pom.xml | 92 --- .../src/main/java/callbacks/OrderCallback.java | 30 - .../src/main/java/callbacks/OrderRequest.java | 24 - .../src/main/java/callbacks/OrderResponse.java | 24 - .../src/main/java/callbacks/OrderService.java | 33 -- .../main/java/callbacks/OrderServiceClient.java | 59 -- .../src/main/java/callbacks/OrderServiceImpl.java | 51 -- .../src/main/resources/callbacks.composite | 44 -- .../src/main/resources/jndi.properties | 30 - .../src/test/java/callbacks/CallbacksTestCase.java | 64 -- java/sca/samples/chat-webapp/README | 83 --- java/sca/samples/chat-webapp/chat-webapp.png | Bin 6552 -> 0 bytes java/sca/samples/chat-webapp/chat-webapp.svg | 187 ------ java/sca/samples/chat-webapp/pom.xml | 97 --- .../src/main/java/sample/ChatService.java | 26 - .../src/main/java/sample/ChatServiceImpl.java | 36 -- .../chat-webapp/src/main/resources/chat.composite | 40 -- .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../chat-webapp/src/main/webapp/WEB-INF/web.xml | 37 -- .../samples/chat-webapp/src/main/webapp/chat.html | 70 --- java/sca/samples/chat2-webapp/README | 61 -- java/sca/samples/chat2-webapp/build.xml | 117 ---- java/sca/samples/chat2-webapp/pom.xml | 104 ---- .../src/main/java/sample/ChatCallback.java | 27 - .../src/main/java/sample/ChatService.java | 32 - .../src/main/java/sample/ChatServiceImpl.java | 36 -- .../chat2-webapp/src/main/resources/chat.composite | 40 -- .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../chat2-webapp/src/main/webapp/WEB-INF/web.xml | 37 -- .../samples/chat2-webapp/src/main/webapp/chat.html | 73 --- java/sca/samples/customer-dojo-webapp/README | 104 ---- .../samples/customer-dojo-webapp/build-dojo.xml | 92 --- java/sca/samples/customer-dojo-webapp/build.xml | 70 --- .../customer-dojo-webapp/customer-dojo-jsonrpc.png | Bin 9947 -> 0 bytes .../customer-dojo-webapp/customer-dojo-jsonrpc.svg | 177 ------ java/sca/samples/customer-dojo-webapp/customer.sql | 33 -- java/sca/samples/customer-dojo-webapp/pom.xml | 232 -------- .../src/main/java/customer/Customer.java | 93 --- .../src/main/java/customer/CustomerCollection.java | 26 - .../main/java/customer/CustomerCollectionImpl.java | 101 ---- .../src/main/java/customer/CustomerService.java | 31 - .../main/java/customer/CustomerServiceImpl.java | 117 ---- .../src/main/java/launch/Launch.java | 34 -- .../src/main/resources/META-INF/orm.xml | 51 -- .../src/main/resources/META-INF/persistence.xml | 40 -- .../main/resources/META-INF/sca-contribution.xml | 26 - .../src/main/resources/customer.composite | 37 -- .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 -- .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/customer.jsp | 80 --- java/sca/samples/customer-dojo/README | 104 ---- java/sca/samples/customer-dojo/build-dojo.xml | 92 --- java/sca/samples/customer-dojo/build.xml | 70 --- .../customer-dojo/customer-dojo-jsonrpc.png | Bin 9947 -> 0 bytes .../customer-dojo/customer-dojo-jsonrpc.svg | 177 ------ java/sca/samples/customer-dojo/customer.sql | 33 -- java/sca/samples/customer-dojo/pom.xml | 244 -------- .../src/main/java/customer/Customer.java | 93 --- .../src/main/java/customer/CustomerCollection.java | 26 - .../main/java/customer/CustomerCollectionImpl.java | 101 ---- .../src/main/java/customer/CustomerService.java | 31 - .../main/java/customer/CustomerServiceImpl.java | 117 ---- .../customer-dojo/src/main/java/launch/Launch.java | 35 -- .../src/main/resources/META-INF/orm.xml | 51 -- .../src/main/resources/META-INF/persistence.xml | 40 -- .../main/resources/META-INF/sca-contribution.xml | 26 - .../src/main/resources/content/customer.html | 77 --- .../src/main/resources/customer.composite | 44 -- java/sca/samples/databinding-echo/README | 143 ----- java/sca/samples/databinding-echo/build.xml | 75 --- .../samples/databinding-echo/databinding-echo.png | Bin 23907 -> 0 bytes .../samples/databinding-echo/databinding-echo.svg | 408 ------------- java/sca/samples/databinding-echo/pom.xml | 82 --- .../src/main/java/dbecho/ComponentAImpl.java | 74 --- .../src/main/java/dbecho/ComponentBImpl.java | 59 -- .../src/main/java/dbecho/Echo.java | 32 - .../main/java/dbecho/EchoDataBindingClient.java | 45 -- .../src/main/java/dbecho/Interface1.java | 32 - .../src/main/java/dbecho/Interface2.java | 36 -- .../src/main/resources/EchoDataBinding.composite | 58 -- .../src/main/resources/wsdl/echo.wsdl | 63 -- .../test/java/dbecho/EchoDataBindingTestCase.java | 49 -- java/sca/samples/domain-management/README | 8 - java/sca/samples/domain-management/pom.xml | 247 -------- .../java/manager/DistributeAndRunComponents.java | 328 ---------- .../main/java/manager/DistributeComponents.java | 288 --------- .../src/main/java/manager/ListComponents.java | 158 ----- .../src/main/java/manager/ListDependencies.java | 108 ---- .../src/main/java/manager/ListDeployables.java | 73 --- .../src/main/java/manager/WireComponents.java | 218 ------- .../src/test/java/services/Cart.java | 28 - .../src/test/java/services/Item.java | 66 --- .../test/java/services/ShoppingCartClientImpl.java | 57 -- .../src/test/java/services/ShoppingCartImpl.java | 100 ---- .../src/test/resources/assembly/assets.xml | 38 -- .../src/test/resources/assembly/client.xml | 34 -- .../src/test/resources/assembly/store.xml | 34 -- .../resources/assets/META-INF/sca-contribution.xml | 22 - .../resources/client/META-INF/sca-contribution.xml | 24 - .../src/test/resources/client/client.composite | 35 -- .../resources/store/META-INF/sca-contribution.xml | 24 - .../src/test/resources/store/store.composite | 32 - java/sca/samples/domain-webapp/README | 310 ---------- java/sca/samples/domain-webapp/build.xml | 296 --------- java/sca/samples/domain-webapp/pom.xml | 101 ---- .../src/main/java/node/DomainServer.java | 54 -- .../main/resources/META-INF/sca-contribution.xml | 24 - .../src/main/resources/domain.composite | 54 -- .../src/main/resources/webroot/index.html | 354 ----------- .../src/main/resources/webroot/node.png | Bin 689 -> 0 bytes .../src/main/resources/webroot/style.css | 176 ------ java/sca/samples/feed-aggregator-webapp/README | 55 -- .../feed-aggregator-webapp.png | Bin 23443 -> 0 bytes .../feed-aggregator-webapp.svg | 382 ------------ java/sca/samples/feed-aggregator-webapp/pom.xml | 108 ---- .../src/main/java/feed/AggregatorImpl.java | 178 ------ .../src/main/java/feed/Sort.java | 38 -- .../src/main/java/feed/SortImpl.java | 57 -- .../src/main/resources/FeedAggregator.composite | 60 -- .../src/main/webapp/META-INF/sca-contribution.xml | 26 - .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/index.html | 32 - java/sca/samples/feed-aggregator/README | 110 ---- java/sca/samples/feed-aggregator/build.xml | 72 --- .../samples/feed-aggregator/feed-aggregator.png | Bin 17429 -> 0 bytes .../samples/feed-aggregator/feed-aggregator.svg | 364 ------------ java/sca/samples/feed-aggregator/pom.xml | 84 --- .../src/main/java/feed/AggregatorImpl.java | 188 ------ .../feed-aggregator/src/main/java/feed/Sort.java | 38 -- .../src/main/java/feed/SortImpl.java | 57 -- .../src/main/java/launch/LaunchFeedServer.java | 47 -- .../src/main/resources/FeedAggregator.composite | 60 -- .../src/test/java/feed/FeedAggregatorTest.java | 332 ----------- java/sca/samples/helloworld-bpel-ws/README | 151 ----- java/sca/samples/helloworld-bpel-ws/build.xml | 95 --- .../samples/helloworld-bpel-ws/helloworld-bpel.png | Bin 8897 -> 0 bytes .../samples/helloworld-bpel-ws/helloworld-bpel.svg | 179 ------ java/sca/samples/helloworld-bpel-ws/pom.xml | 205 ------- .../src/main/java/helloworld/BPELClient.java | 43 -- .../src/main/resources/deploy.xml | 31 - .../src/main/resources/helloworld.bpel | 66 --- .../src/main/resources/helloworld.componentType | 30 - .../src/main/resources/helloworld.composite | 33 -- .../src/main/resources/helloworld.wsdl | 82 --- .../src/main/resources/log4j.properties | 35 -- .../java/helloworld/BPELHelloWorldTestCase.java | 59 -- java/sca/samples/helloworld-bpel/README | 151 ----- java/sca/samples/helloworld-bpel/build.xml | 95 --- .../samples/helloworld-bpel/helloworld-bpel.png | Bin 8897 -> 0 bytes .../samples/helloworld-bpel/helloworld-bpel.svg | 179 ------ java/sca/samples/helloworld-bpel/pom.xml | 198 ------- .../src/main/java/helloworld/BPELClient.java | 43 -- .../helloworld-bpel/src/main/resources/deploy.xml | 31 - .../src/main/resources/helloworld.bpel | 66 --- .../src/main/resources/helloworld.componentType | 30 - .../src/main/resources/helloworld.composite | 29 - .../src/main/resources/helloworld.wsdl | 82 --- .../src/main/resources/log4j.properties | 35 -- .../java/helloworld/BPELHelloWorldTestCase.java | 59 -- java/sca/samples/helloworld-distributed/README | 29 - .../helloworld-distributed/helloworld-node/README | 29 - .../helloworld-distributed/helloworld-node/pom.xml | 57 -- .../src/main/java/sample/Helloworld.java | 29 - .../src/main/java/sample/HelloworldImpl.java | 29 - .../META-INF/sca-deployables/Helloworld.composite | 28 - .../helloworld-webapp/README | 29 - .../helloworld-webapp/build.xml | 127 ---- .../helloworld-webapp/pom.xml | 78 --- .../src/main/java/sample/Helloworld.java | 27 - .../src/main/webapp/WEB-INF/web.composite | 29 - .../src/main/webapp/WEB-INF/web.xml | 41 -- .../helloworld-webapp/src/main/webapp/hello.jsp | 36 -- java/sca/samples/helloworld-dojo-webapp/README | 104 ---- .../samples/helloworld-dojo-webapp/build-dojo.xml | 92 --- java/sca/samples/helloworld-dojo-webapp/build.xml | 70 --- .../helloworld-dojo-webapp/helloworld-jsonrpc.png | Bin 9947 -> 0 bytes .../helloworld-dojo-webapp/helloworld-jsonrpc.svg | 177 ------ java/sca/samples/helloworld-dojo-webapp/pom.xml | 163 ----- .../java/helloworldjsonrpc/HelloWorldService.java | 28 - .../helloworldjsonrpc/HelloWorldServiceImpl.java | 38 -- .../src/main/resources/jsonrpc.composite | 37 -- .../src/main/webapp/HelloWorldJSONRPC.html | 98 --- .../src/main/webapp/META-INF/sca-contribution.xml | 26 - .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/style.css | 22 - java/sca/samples/helloworld-jms-webapp/README | 130 ---- java/sca/samples/helloworld-jms-webapp/pom.xml | 72 --- .../src/main/java/helloworld/HelloWorldClient.java | 37 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../java/helloworld/HelloWorldServiceImpl.java | 34 -- .../src/main/webapp/META-INF/context.xml | 29 - .../META-INF/sca-deployables/HelloWorld.composite | 39 -- .../src/main/webapp/WEB-INF/web.xml | 66 --- .../src/main/webapp/hello.jsp | 44 -- java/sca/samples/helloworld-jsonrpc-webapp/README | 90 --- .../helloworld-jsonrpc.png | Bin 9947 -> 0 bytes .../helloworld-jsonrpc.svg | 177 ------ java/sca/samples/helloworld-jsonrpc-webapp/pom.xml | 103 ---- .../java/helloworldjsonrpc/HelloWorldService.java | 28 - .../helloworldjsonrpc/HelloWorldServiceImpl.java | 36 -- .../src/main/resources/jsonrpc.composite | 37 -- .../src/main/webapp/HelloWorldJSONRPC.html | 75 --- .../src/main/webapp/META-INF/sca-contribution.xml | 26 - .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/style.css | 22 - java/sca/samples/helloworld-jsp/pom.xml | 54 -- .../src/main/java/sample/HelloworldService.java | 7 - .../main/java/sample/HelloworldServiceImpl.java | 12 - .../webapp/META-INF/sca-deployables/web.composite | 34 -- .../helloworld-jsp/src/main/webapp/WEB-INF/web.xml | 42 -- .../helloworld-jsp/src/main/webapp/hello.jsp | 36 -- java/sca/samples/helloworld-reference-jms/README | 114 ---- .../sca/samples/helloworld-reference-jms/build.xml | 72 --- .../helloworld-reference.png | Bin 12973 -> 0 bytes .../helloworld-reference.svg | 144 ----- java/sca/samples/helloworld-reference-jms/pom.xml | 92 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../main/java/helloworld/HelloWorldJmsClient.java | 41 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../helloworld/HelloWorldServiceComponent.java | 42 -- .../resources/helloworldjmsreference.composite | 40 -- .../main/resources/helloworldjmsservice.composite | 39 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../helloworld/HelloWorldJmsClientTestCase.java | 80 --- java/sca/samples/helloworld-service-jms/README | 101 ---- java/sca/samples/helloworld-service-jms/build.xml | 72 --- .../helloworld-service-jms/helloworld-service.png | Bin 9455 -> 0 bytes .../helloworld-service-jms/helloworld-service.svg | 139 ----- java/sca/samples/helloworld-service-jms/pom.xml | 85 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../src/main/java/helloworld/HelloWorldServer.java | 58 -- .../main/java/helloworld/HelloWorldService.java | 31 - .../src/main/resources/definitions.xml | 66 --- .../main/resources/helloworldjmsservice.composite | 40 -- .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../helloworld/HelloWorldJmsServerTestCaseOff.java | 60 -- java/sca/samples/helloworld-servlet/pom.xml | 61 -- .../src/main/java/sample/HelloworldService.java | 7 - .../main/java/sample/HelloworldServiceImpl.java | 12 - .../src/main/java/sample/HelloworldServlet.java | 65 -- .../webapp/META-INF/sca-deployables/web.composite | 33 -- .../src/main/webapp/WEB-INF/web.xml | 52 -- .../helloworld-servlet/src/main/webapp/hello.html | 46 -- java/sca/samples/helloworld-web-callback/pom.xml | 68 --- .../src/main/java/sample/HelloworldCallback.java | 30 - .../src/main/java/sample/HelloworldService.java | 14 - .../main/java/sample/HelloworldServiceImpl.java | 27 - .../webapp/META-INF/sca-deployables/web.composite | 45 -- .../src/main/webapp/WEB-INF/web.xml | 42 -- .../src/main/webapp/hello.html | 63 -- java/sca/samples/helloworld-web/pom.xml | 68 --- .../src/main/java/sample/HelloworldService.java | 7 - .../main/java/sample/HelloworldServiceImpl.java | 12 - .../webapp/META-INF/sca-deployables/web.composite | 39 -- .../helloworld-web/src/main/webapp/WEB-INF/web.xml | 42 -- .../helloworld-web/src/main/webapp/hello.html | 62 -- java/sca/samples/helloworld-ws-deep-webapp/README | 1 - .../samples/helloworld-ws-deep-webapp/build.xml | 158 ----- java/sca/samples/helloworld-ws-deep-webapp/pom.xml | 45 -- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../main/java/helloworld/HelloWorldService.java | 30 - .../sca-deployables/helloworldws.composite | 32 - .../src/main/resources/wsdl/helloworld.wsdl | 79 --- .../src/main/webapp/WEB-INF/web.xml | 27 - .../sca/samples/helloworld-ws-reference-jms/README | 127 ---- .../samples/helloworld-ws-reference-jms/build.xml | 72 --- .../helloworld-ws-reference.png | Bin 7549 -> 0 bytes .../helloworld-ws-reference.svg | 150 ----- .../samples/helloworld-ws-reference-jms/pom.xml | 92 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../main/java/helloworld/HelloWorldJmsClient.java | 38 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../helloworld/HelloWorldServiceComponent.java | 42 -- .../src/main/resources/helloworldwsjms.composite | 34 -- .../main/resources/helloworldwsjmsclient.composite | 45 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../helloworld/HelloWorldJmsClientTestCase.java | 84 --- .../samples/helloworld-ws-reference-lean/README | 178 ------ .../helloworld-ws-reference.png | Bin 7549 -> 0 bytes .../helloworld-ws-reference.svg | 150 ----- .../samples/helloworld-ws-reference-lean/pom.xml | 79 --- .../src/main/java/helloworld/HelloWorldClient.java | 47 -- .../main/java/helloworld/HelloWorldClient2.java | 53 -- .../main/java/helloworld/HelloWorldClient3.java | 47 -- .../main/java/helloworld/HelloWorldClient4.java | 52 -- .../main/java/helloworld/HelloWorldClient5.java | 47 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../main/resources/helloworldwsclient.composite | 33 -- .../main/resources/helloworldwsclient2.composite | 33 -- .../main/resources/helloworldwsclient3.composite | 33 -- .../main/resources/helloworldwsclient4.composite | 34 -- .../main/resources/helloworldwsclient5.composite | 33 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../java/helloworld/HelloWorldClientTestCase.java | 58 -- .../test/java/helloworld/HelloWorldTestServer.java | 55 -- .../samples/helloworld-ws-reference-secure/README | 176 ------ .../helloworld-ws-reference-secure/build.xml | 72 --- .../helloworld-ws-reference-secure.png | Bin 7549 -> 0 bytes .../helloworld-ws-reference-secure.svg | 150 ----- .../samples/helloworld-ws-reference-secure/pom.xml | 85 --- .../main/java/helloworld/ClientPWCBHandler.java | 45 -- .../src/main/java/helloworld/HelloWorldClient.java | 42 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../helloworld/HelloWorldServiceComponent.java | 42 -- ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 21 - .../src/main/resources/definitions.xml | 203 ------- .../src/main/resources/helloworldKeys.jks | Bin 1366 -> 0 bytes .../main/resources/helloworldwsclient.composite | 58 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 85 --- .../java/helloworld/HelloWorldClientTestCase.java | 74 --- .../test/java/helloworld/HelloWorldTestServer.java | 55 -- java/sca/samples/helloworld-ws-reference/README | 178 ------ java/sca/samples/helloworld-ws-reference/build.xml | 72 --- .../helloworld-ws-reference.png | Bin 7549 -> 0 bytes .../helloworld-ws-reference.svg | 150 ----- java/sca/samples/helloworld-ws-reference/pom.xml | 79 --- .../src/main/java/helloworld/HelloWorldClient.java | 38 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../helloworld/HelloWorldServiceComponent.java | 42 -- .../main/resources/helloworldwsclient.composite | 45 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../java/helloworld/HelloWorldClientTestCase.java | 74 --- .../test/java/helloworld/HelloWorldTestServer.java | 55 -- java/sca/samples/helloworld-ws-sdo-webapp/README | 92 --- .../sca/samples/helloworld-ws-sdo-webapp/build.xml | 99 ---- .../helloworld-ws-sdo-webapp.png | Bin 12242 -> 0 bytes .../helloworld-ws-sdo-webapp.svg | 221 ------- java/sca/samples/helloworld-ws-sdo-webapp/pom.xml | 200 ------- .../src/main/java/helloworld/HelloWorld.java | 44 -- .../main/java/helloworld/HelloWorldComponent.java | 40 -- .../src/main/java/helloworld/HelloWorldImpl.java | 48 -- .../src/main/resources/helloworldws.composite | 43 -- .../src/main/resources/wsdl/helloworld.wsdl | 111 ---- .../src/main/resources/wsdl/helloworld.xsd | 30 - .../src/main/webapp/HelloWorld.jsp | 48 -- .../src/main/webapp/META-INF/sca-contribution.xml | 24 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 41 -- .../src/main/webapp/WEB-INF/web.xml | 46 -- java/sca/samples/helloworld-ws-sdo/README | 214 ------- java/sca/samples/helloworld-ws-sdo/build.xml | 101 ---- .../helloworld-ws-sdo/helloworld-ws-sdo.png | Bin 7549 -> 0 bytes .../helloworld-ws-sdo/helloworld-ws-sdo.svg | 150 ----- java/sca/samples/helloworld-ws-sdo/pom.xml | 139 ----- .../src/main/java/helloworld/HelloWorldClient.java | 44 -- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../src/main/java/helloworld/HelloWorldServer.java | 46 -- .../main/java/helloworld/HelloWorldService.java | 29 - .../helloworld/HelloWorldServiceComponent.java | 42 -- .../src/main/resources/helloworldws.composite | 32 - .../main/resources/helloworldwsclient.composite | 33 -- .../src/main/resources/logging.properties | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 88 --- .../java/helloworld/HelloWorldClientTestCase.java | 69 --- .../test/java/helloworld/HelloWorldTestServer.java | 55 -- java/sca/samples/helloworld-ws-service-jms/README | 119 ---- .../samples/helloworld-ws-service-jms/build.xml | 72 --- .../helloworld-ws-service.png | Bin 6531 -> 0 bytes .../helloworld-ws-service.svg | 150 ----- java/sca/samples/helloworld-ws-service-jms/pom.xml | 87 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../src/main/java/helloworld/HelloWorldServer.java | 60 -- .../main/java/helloworld/HelloWorldService.java | 31 - .../src/main/resources/definitions.xml | 66 --- .../src/main/resources/helloworldwsjms.composite | 35 -- .../main/resources/helloworldwsjmspolicy.composite | 34 -- .../src/main/resources/wsdl/helloworld.wsdl | 92 --- .../HelloWorldJmsPolicyServerTestCase.java | 68 --- .../helloworld/HelloWorldJmsServerTestCase.java | 72 --- .../samples/helloworld-ws-service-secure/README | 152 ----- .../samples/helloworld-ws-service-secure/build.xml | 72 --- .../helloworld-ws-service-secure.png | Bin 158 -> 0 bytes .../helloworld-ws-service-secure.svg | 149 ----- .../samples/helloworld-ws-service-secure/pom.xml | 85 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../src/main/java/helloworld/HelloWorldServer.java | 46 -- .../main/java/helloworld/HelloWorldService.java | 31 - .../main/java/helloworld/ServerPWCBHandler.java | 55 -- .../src/main/resources/definitions.xml | 113 ---- .../src/main/resources/helloworldKeys.jks | Bin 1366 -> 0 bytes .../src/main/resources/helloworldws.composite | 41 -- .../src/main/resources/wsdl/helloworld.wsdl | 79 --- .../java/helloworld/HelloWorldServerTestCase.java | 62 -- .../samples/helloworld-ws-service-webapp/README | 1 - .../samples/helloworld-ws-service-webapp/build.xml | 156 ----- .../samples/helloworld-ws-service-webapp/pom.xml | 80 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../main/java/helloworld/HelloWorldService.java | 30 - .../src/main/resources/wsdl/helloworld.wsdl | 79 --- .../sca-deployables/helloworldws.composite | 32 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 33 -- .../src/main/webapp/WEB-INF/web.xml | 45 -- java/sca/samples/helloworld-ws-service/README | 140 ----- java/sca/samples/helloworld-ws-service/build.xml | 72 --- .../helloworld-ws-service.png | Bin 6531 -> 0 bytes .../helloworld-ws-service.svg | 150 ----- java/sca/samples/helloworld-ws-service/pom.xml | 79 --- .../src/main/java/helloworld/HelloWorldImpl.java | 33 -- .../src/main/java/helloworld/HelloWorldServer.java | 46 -- .../main/java/helloworld/HelloWorldService.java | 31 - .../org/example/orderservice/ObjectFactory.java | 56 -- .../main/java/org/example/orderservice/Order.java | 129 ---- .../org/example/orderservice/OrderService.java | 37 -- .../org/example/orderservice/OrderServiceImpl.java | 65 -- .../example/orderservice/OrderService_Service.java | 66 --- .../java/org/example/orderservice/ReviewOrder.java | 64 -- .../example/orderservice/ReviewOrderResponse.java | 64 -- .../main/java/org/example/orderservice/Status.java | 57 -- .../org/example/orderservice/package-info.java | 2 - .../sca-deployables/helloworldws.composite | 33 -- .../META-INF/sca-deployables/orderws.composite | 33 -- .../src/main/resources/wsdl/helloworld.wsdl | 79 --- .../src/main/resources/wsdl/orderservice.wsdl | 71 --- .../java/helloworld/HelloWorldServerTestCase.java | 62 -- java/sca/samples/host-webapp-calculator/README | 108 ---- java/sca/samples/host-webapp-calculator/build.xml | 31 - .../host-webapp-calculator/calculator-web.png | Bin 25757 -> 0 bytes .../host-webapp-calculator/calculator-web.svg | 455 -------------- java/sca/samples/host-webapp-calculator/pom.xml | 162 ----- .../src/main/java/calculator/AddService.java | 31 - .../src/main/java/calculator/AddServiceImpl.java | 34 -- .../main/java/calculator/CalculatorService.java | 35 -- .../java/calculator/CalculatorServiceImpl.java | 69 --- .../src/main/java/calculator/DivideService.java | 28 - .../main/java/calculator/DivideServiceImpl.java | 30 - .../src/main/java/calculator/MultiplyService.java | 28 - .../main/java/calculator/MultiplyServiceImpl.java | 30 - .../src/main/java/calculator/SubtractService.java | 28 - .../main/java/calculator/SubtractServiceImpl.java | 30 - .../src/main/resources/Calculator.composite | 49 -- .../src/main/webapp/META-INF/sca-contribution.xml | 23 - .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 -- .../src/main/webapp/WEB-INF/web.composite | 24 - .../src/main/webapp/WEB-INF/web.xml | 41 -- .../src/main/webapp/calc.jsp | 50 -- java/sca/samples/implementation-composite/README | 116 ---- .../sca/samples/implementation-composite/build.xml | 72 --- .../implementation-composite.png | Bin 47415 -> 0 bytes .../implementation-composite.svg | 658 --------------------- java/sca/samples/implementation-composite/pom.xml | 72 --- .../src/main/java/composite/CompositeClient.java | 41 -- .../src/main/java/composite/Source.java | 24 - .../src/main/java/composite/SourceCallback.java | 24 - .../src/main/java/composite/SourceImpl.java | 55 -- .../src/main/java/composite/Target.java | 30 - .../src/main/java/composite/TargetImpl.java | 41 -- .../src/main/resources/InnerComposite.composite | 41 -- .../src/main/resources/InnerComposite2.composite | 33 -- .../main/resources/META-INF/sca-contribution.xml | 25 - .../src/main/resources/OuterComposite.composite | 39 -- .../src/test/java/composite/CompositeTestCase.java | 51 -- .../samples/implementation-crud-extension/README | 83 --- .../implementation-crud-extension/build.xml | 51 -- .../samples/implementation-crud-extension/pom.xml | 77 --- .../src/main/java/crud/CRUD.java | 54 -- .../src/main/java/crud/CRUDImplementation.java | 50 -- .../main/java/crud/CRUDImplementationFactory.java | 37 -- .../main/java/crud/backend/ResourceManager.java | 90 --- .../crud/impl/CRUDImplementationFactoryImpl.java | 47 -- .../java/crud/impl/CRUDImplementationImpl.java | 117 ---- .../crud/provider/CRUDImplementationInvoker.java | 79 --- .../crud/provider/CRUDImplementationProvider.java | 75 --- .../CRUDImplementationProviderFactory.java | 51 -- .../services/crud.CRUDImplementationFactory | 19 - ...ca.contribution.processor.StAXArtifactProcessor | 19 - ...any.sca.contribution.processor.ValidationSchema | 19 - ...cany.sca.provider.ImplementationProviderFactory | 19 - .../main/resources/sample-implementation-crud.xsd | 38 -- .../src/test/java/crud/CRUDTestCase.java | 60 -- .../src/test/resources/crud.composite | 30 - java/sca/samples/implementation-crud/README | 113 ---- java/sca/samples/implementation-crud/build.xml | 75 --- .../implementation-crud/implementation-crud.png | Bin 4227 -> 0 bytes .../implementation-crud/implementation-crud.svg | 135 ----- java/sca/samples/implementation-crud/pom.xml | 64 -- .../src/main/java/crud/client/CRUDClient.java | 59 -- .../src/main/resources/crud.composite | 30 - .../src/test/java/crud/client/CRUDTestCase.java | 61 -- .../sca/samples/implementation-notification/README | 97 --- .../samples/implementation-notification/build.xml | 72 --- .../implementation-notification.png | Bin 21543 -> 0 bytes .../samples/implementation-notification/pom.xml | 76 --- .../main/java/notification/TestCaseProducer.java | 24 - .../main/java/notification/TrafficAdvisory.java | 24 - .../java/notification/TrafficAdvisoryClient.java | 45 -- .../java/notification/TrafficAdvisoryConsumer.java | 39 -- .../java/notification/TrafficAdvisoryProducer.java | 36 -- .../TrafficAdvisoryNotification.componentType | 30 - .../TrafficAdvisoryNotification.composite | 50 -- .../java/notification/TrafficAdvisoryTestCase.java | 60 -- .../TrafficAdvisoryNotification.componentType | 30 - .../TrafficAdvisoryNotification.composite | 50 -- .../samples/implementation-pojo-extension/README | 70 --- .../implementation-pojo-extension/build.xml | 51 -- .../samples/implementation-pojo-extension/pom.xml | 77 --- .../src/main/java/pojo/POJOImplementation.java | 65 -- .../main/java/pojo/POJOImplementationFactory.java | 36 -- .../pojo/impl/POJOImplementationFactoryImpl.java | 36 -- .../java/pojo/impl/POJOImplementationImpl.java | 155 ----- .../pojo/impl/POJOImplementationProcessor.java | 174 ------ .../pojo/provider/POJOImplementationInvoker.java | 68 --- .../pojo/provider/POJOImplementationProvider.java | 106 ---- .../POJOImplementationProviderFactory.java | 45 -- ...ca.contribution.processor.StAXArtifactProcessor | 19 - ...any.sca.contribution.processor.ValidationSchema | 19 - ...cany.sca.provider.ImplementationProviderFactory | 19 - .../services/pojo.POJOImplementationFactory | 19 - .../main/resources/sample-implementation-pojo.xsd | 38 -- .../src/test/java/helloworld/HelloWorld.java | 26 - .../src/test/java/helloworld/HelloWorldImpl.java | 37 -- .../src/test/java/helloworld/HelloWorldImpl2.java | 37 -- .../test/java/helloworld/HelloWorldTestCase.java | 51 -- .../helloworld/HelloWorldImpl2.componentType | 26 - .../test/resources/helloworld/helloworld.composite | 33 -- java/sca/samples/loanapplication/pom.xml | 65 -- .../main/java/loanapplication/LoanApplication.java | 36 -- .../loanapplication/LoanApplicationClient.java | 37 -- .../src/main/java/loanapplication/LoanClient.java | 29 - .../main/java/loanapplication/LoanClientImpl.java | 64 -- .../src/main/java/loanapplication/LoanService.java | 43 -- .../main/java/loanapplication/LoanServiceImpl.java | 63 -- .../src/main/resources/loanapplication.composite | 34 -- .../loanapplication/LoanApplicationTestCase.java | 83 --- java/sca/samples/osgi-supplychain/README | 161 ----- .../sca/samples/osgi-supplychain/build-bundles.xml | 32 - java/sca/samples/osgi-supplychain/build.xml | 128 ---- .../samples/osgi-supplychain/osgi-supplychain.png | Bin 13558 -> 0 bytes .../samples/osgi-supplychain/osgi-supplychain.svg | 272 --------- java/sca/samples/osgi-supplychain/pom.xml | 187 ------ .../src/main/java/supplychain/OSGiBundleImpl.java | 121 ---- .../main/java/supplychain/SupplyChainClient.java | 43 -- .../main/java/supplychain/customer/Customer.java | 33 -- .../customer/JavaCustomerComponentImpl.java | 50 -- .../customer/OSGiCustomerComponentImpl.java | 51 -- .../supplychain/customer/OSGiCustomerImpl.java | 47 -- .../retailer/JavaRetailerComponentImpl.java | 53 -- .../retailer/OSGiRetailerComponentImpl.java | 46 -- .../supplychain/retailer/OSGiRetailerImpl.java | 44 -- .../main/java/supplychain/retailer/Retailer.java | 28 - .../shipper/JavaShipperComponentImpl.java | 47 -- .../shipper/OSGiShipperComponentImpl.java | 45 -- .../java/supplychain/shipper/OSGiShipperImpl.java | 42 -- .../src/main/java/supplychain/shipper/Shipper.java | 28 - .../warehouse/JavaWarehouseComponentImpl.java | 47 -- .../warehouse/OSGiWarehouseComponentImpl.java | 47 -- .../supplychain/warehouse/OSGiWarehouseImpl.java | 44 -- .../main/java/supplychain/warehouse/Warehouse.java | 28 - .../src/main/resources/Customer.componentType | 28 - .../src/main/resources/DSCustomer.componentType | 28 - .../src/main/resources/DSRetailer.componentType | 28 - .../src/main/resources/DSShipper.componentType | 28 - .../src/main/resources/DSWarehouse.componentType | 28 - .../src/main/resources/Retailer.componentType | 28 - .../src/main/resources/Shipper.componentType | 28 - .../src/main/resources/Warehouse.componentType | 28 - .../src/main/resources/osgi/Customer.mf | 11 - .../src/main/resources/osgi/Retailer.mf | 10 - .../src/main/resources/osgi/Shipper.mf | 10 - .../src/main/resources/osgi/Warehouse.mf | 10 - .../src/main/resources/osgi/ds/Customer.mf | 10 - .../src/main/resources/osgi/ds/Customer.xml | 32 - .../src/main/resources/osgi/ds/Retailer.mf | 11 - .../src/main/resources/osgi/ds/Retailer.xml | 32 - .../src/main/resources/osgi/ds/Shipper.mf | 10 - .../src/main/resources/osgi/ds/Shipper.xml | 33 -- .../src/main/resources/osgi/ds/Warehouse.mf | 11 - .../src/main/resources/osgi/ds/Warehouse.xml | 32 - .../src/main/resources/supplychain.composite | 61 -- .../src/main/resources/supplychain.ds.composite | 61 -- .../supplychain/SupplyChainClientTestCase.java | 60 -- java/sca/samples/photo-gallery/README | 28 - java/sca/samples/photo-gallery/build.xml | 79 --- java/sca/samples/photo-gallery/photo-gallery.png | Bin 15670 -> 0 bytes java/sca/samples/photo-gallery/photo-gallery.svg | 304 ---------- java/sca/samples/photo-gallery/pom.xml | 148 ----- .../src/main/java/launch/LaunchGallery.java | 34 -- .../src/main/java/launch/LaunchGalleryJCR.java | 34 -- .../src/main/java/services/Album.java | 29 - .../src/main/java/services/AlbumImpl.java | 95 --- .../src/main/java/services/jcr/AlbumImpl.java | 159 ----- .../photo-gallery/src/main/resources/gallery.html | 135 ----- .../src/main/resources/gallery/boston/dsc00368.jpg | Bin 32808 -> 0 bytes .../src/main/resources/gallery/boston/dsc00369.jpg | Bin 35980 -> 0 bytes .../src/main/resources/gallery/boston/dsc00370.jpg | Bin 44614 -> 0 bytes .../src/main/resources/gallery/boston/dsc00371.jpg | Bin 40745 -> 0 bytes .../src/main/resources/gallery/boston/dsc00373.jpg | Bin 76470 -> 0 bytes .../src/main/resources/gallery/boston/dsc00375.jpg | Bin 34834 -> 0 bytes .../src/main/resources/gallery/boston/dsc00376.jpg | Bin 38797 -> 0 bytes .../src/main/resources/gallery/boston/dsc00377.jpg | Bin 35776 -> 0 bytes .../src/main/resources/gallery/boston/dsc00378.jpg | Bin 35248 -> 0 bytes .../src/main/resources/gallery/boston/dsc00379.jpg | Bin 55042 -> 0 bytes .../src/main/resources/gallery/boston/dsc00380.jpg | Bin 55236 -> 0 bytes .../photo-gallery/src/main/resources/index.gif | Bin 564 -> 0 bytes .../photo-gallery/src/main/resources/index_on.gif | Bin 577 -> 0 bytes .../photo-gallery/src/main/resources/next.gif | Bin 535 -> 0 bytes .../src/main/resources/next_disabled.gif | Bin 536 -> 0 bytes .../photo-gallery/src/main/resources/next_on.gif | Bin 542 -> 0 bytes .../src/main/resources/photo-gallery-jcr.composite | 47 -- .../src/main/resources/photo-gallery.composite | 47 -- .../photo-gallery/src/main/resources/prev.gif | Bin 534 -> 0 bytes .../src/main/resources/prev_disabled.gif | Bin 536 -> 0 bytes .../photo-gallery/src/main/resources/prev_on.gif | Bin 541 -> 0 bytes .../src/main/resources/show_slide.gif | Bin 533 -> 0 bytes .../photo-gallery/src/main/resources/space.gif | Bin 116 -> 0 bytes .../photo-gallery/src/main/resources/styles.css | 121 ---- java/sca/samples/pom.xml | 72 +-- java/sca/samples/quote-xquery/README | 450 -------------- java/sca/samples/quote-xquery/build.xml | 120 ---- java/sca/samples/quote-xquery/pom.xml | 184 ------ .../java/xquery/quote/AvailQuoteProviderImpl.java | 30 - .../xquery/quote/AvailQuoteProviderNodeInfo.java | 28 - .../xquery/quote/AvailQuoteProviderService.java | 27 - .../xquery/quote/ExternalReferencesQuoteJoin.java | 27 - .../main/java/xquery/quote/PriceQuoteProvider.java | 28 - .../java/xquery/quote/PriceQuoteProviderImpl.java | 27 - .../xquery/quote/PriceQuoteProviderNodeInfo.java | 28 - .../java/xquery/quote/PropertiesQuoteJoin.java | 32 - .../main/java/xquery/quote/QuoteCalculator.java | 26 - .../java/xquery/quote/QuoteCalculatorImpl.java | 38 -- .../src/main/java/xquery/quote/QuoteDataUtil.java | 107 ---- .../src/main/java/xquery/quote/QuoteJoin.java | 34 -- .../src/main/java/xquery/quote/QuoteJoinLocal.java | 34 -- .../main/java/xquery/quote/QuoteJoinLocalImpl.java | 67 --- .../main/java/xquery/quote/XQueryQuoteClient.java | 145 ----- .../main/java/xquery/quote/XQueryQuoteServer.java | 39 -- .../src/main/resources/META-INF/sca/quote_join.xq | 61 -- .../META-INF/sca/quote_join_external_references.xq | 69 --- .../META-INF/sca/quote_join_properties.xq | 74 --- .../src/main/resources/wsdl/AvailQuote.xsd | 39 -- .../src/main/resources/wsdl/PriceQuote.xsd | 49 -- .../quote-xquery/src/main/resources/wsdl/Quote.xsd | 40 -- .../src/main/resources/wsdl/quotejoin.wsdl | 137 ----- .../src/main/resources/xqueryquotews.composite | 55 -- .../main/resources/xqueryquotewsclient.composite | 113 ---- .../xquery/quote/XQueryQuoteClientTestCase.java | 192 ------ .../java/xquery/quote/XQueryQuoteTestServer.java | 50 -- java/sca/samples/simple-bigbank-spring/README | 148 ----- .../samples/simple-bigbank-spring/build-dojo.xml | 92 --- java/sca/samples/simple-bigbank-spring/build.xml | 72 --- java/sca/samples/simple-bigbank-spring/pom.xml | 277 --------- .../simple-bigbank-spring.png | Bin 10202 -> 0 bytes .../simple-bigbank-spring.svg | 200 ------- .../main/java/bigbank/account/AccountReport.java | 43 -- .../main/java/bigbank/account/AccountService.java | 26 - .../java/bigbank/account/AccountServiceImpl.java | 145 ----- .../account/checking/CheckingAccountDetails.java | 45 -- .../account/checking/CheckingAccountService.java | 34 -- .../java/bigbank/account/feed/AccountFeedImpl.java | 71 --- .../account/savings/SavingsAccountDetails.java | 47 -- .../account/savings/SavingsAccountService.java | 32 - .../account/savings/SavingsAccountServiceImpl.java | 62 -- .../bigbank/account/stock/StockAccountDetails.java | 63 -- .../bigbank/account/stock/StockAccountService.java | 33 -- .../account/stock/StockAccountServiceImpl.java | 56 -- .../java/bigbank/calculator/CalculatorService.java | 34 -- .../main/java/bigbank/client/BigBankClient.java | 46 -- .../main/java/bigbank/server/BigBankServer.java | 54 -- .../java/bigbank/stockquote/StockQuoteService.java | 31 - .../src/main/resources/BigBank.composite | 88 --- .../src/main/resources/SavingsAccount.composite | 32 - .../src/main/resources/StockAccount.composite | 32 - .../spring-context/Account-spring-context.xml | 53 -- .../spring-context/SavingsAccount-context.xml | 33 -- .../StockAccount/META-INF/MANIFEST.MF | 4 - .../META-INF/spring/StockAccount-context.xml | 33 -- .../src/main/resources/web/style.css | 22 - .../src/test/java/bigbank/BigBankTestCase.java | 34 -- java/sca/samples/simple-bigbank/README | 101 ---- java/sca/samples/simple-bigbank/build.xml | 72 --- java/sca/samples/simple-bigbank/pom.xml | 65 -- java/sca/samples/simple-bigbank/simple-bigbank.png | Bin 10202 -> 0 bytes java/sca/samples/simple-bigbank/simple-bigbank.svg | 200 ------- .../main/java/bigbank/account/AccountReport.java | 43 -- .../main/java/bigbank/account/AccountService.java | 26 - .../java/bigbank/account/AccountServiceImpl.java | 68 --- .../src/main/java/bigbank/accountdata/Account.java | 26 - .../bigbank/accountdata/AccountDataService.java | 28 - .../accountdata/AccountDataServiceImpl.java | 54 -- .../java/bigbank/accountdata/CheckingAccount.java | 35 -- .../java/bigbank/accountdata/SavingsAccount.java | 35 -- .../java/bigbank/accountdata/StockAccount.java | 43 -- .../main/java/bigbank/client/BigBankClient.java | 43 -- .../java/bigbank/stockquote/StockQuoteImpl.java | 36 -- .../java/bigbank/stockquote/StockQuoteService.java | 32 - .../src/main/resources/Account.composite | 38 -- .../src/main/resources/BigBank.composite | 35 -- .../src/main/resources/StockQuote.composite | 31 - .../src/test/java/bigbank/BigBankTestCase.java | 50 -- java/sca/samples/simple-callback-ws/README | 144 ----- java/sca/samples/simple-callback-ws/build.xml | 72 --- java/sca/samples/simple-callback-ws/pom.xml | 79 --- .../simple-callback-ws/simple-callback-ws.png | Bin 137 -> 0 bytes .../simple-callback-ws/simple-callback-ws.svg | 150 ----- .../src/main/java/simplecallback/MyClient.java | 27 - .../src/main/java/simplecallback/MyClientImpl.java | 51 -- .../src/main/java/simplecallback/MyService.java | 34 -- .../java/simplecallback/MyServiceCallback.java | 30 - .../main/java/simplecallback/MyServiceImpl.java | 54 -- .../java/simplecallback/SimpleCallbackClient.java | 38 -- .../src/main/resources/simplecallback.composite | 49 -- .../src/main/resources/wsdl/simplecallback.wsdl | 109 ---- .../simplecallback/SimpleCallbackTestCase.java | 53 -- java/sca/samples/simple-callback/README | 97 --- java/sca/samples/simple-callback/build.xml | 72 --- java/sca/samples/simple-callback/pom.xml | 65 -- .../samples/simple-callback/simple-callback.png | Bin 137 -> 0 bytes .../samples/simple-callback/simple-callback.svg | 150 ----- .../src/main/java/simplecallback/MyClient.java | 27 - .../src/main/java/simplecallback/MyClientImpl.java | 49 -- .../src/main/java/simplecallback/MyService.java | 32 - .../java/simplecallback/MyServiceCallback.java | 27 - .../main/java/simplecallback/MyServiceImpl.java | 51 -- .../java/simplecallback/SimpleCallbackClient.java | 38 -- .../src/main/resources/simplecallback.composite | 34 -- .../simplecallback/SimpleCallbackTestCase.java | 51 -- java/sca/samples/spi-implementation-pojo/pom.xml | 59 -- .../src/main/java/sample/JavaImplementation.java | 35 -- .../java/sample/JavaImplementationActivator.java | 37 -- .../src/main/java/sample/JavaInvoker.java | 59 -- .../src/main/java/sample/JavaInvokerFactory.java | 47 -- ....apache.tuscany.sca.spi.ImplementationActivator | 18 - .../src/test/java/helloworld/HelloWorld.java | 26 - .../src/test/java/helloworld/HelloWorldImpl.java | 28 - .../test/java/helloworld/HelloWorldTestCase.java | 35 -- .../test/resources/helloworld/helloworld.composite | 28 - java/sca/samples/spring-bigbank-calculator/README | 2 - .../samples/spring-bigbank-calculator/build.xml | 72 --- java/sca/samples/spring-bigbank-calculator/pom.xml | 110 ---- .../main/java/bigbank/calculator/AddService.java | 25 - .../java/bigbank/calculator/CalculatorService.java | 34 -- .../bigbank/calculator/CalculatorServiceImpl.java | 72 --- .../java/bigbank/calculator/DivideService.java | 25 - .../java/bigbank/calculator/MultiplyService.java | 25 - .../java/bigbank/calculator/SubtractService.java | 25 - .../calculator/server/CalculatorServer.java | 50 -- .../src/main/resources/Calculator.composite | 56 -- .../META-INF/spring/CalculatorService-context.xml | 45 -- .../main/resources/calculator/AddServiceImpl.js | 22 - .../resources/calculator/DivideServiceImpl.groovy | 22 - .../resources/calculator/MultiplyServiceImpl.py | 21 - .../resources/calculator/SubtractServiceImpl.rb | 22 - .../calculator/CalculatorServiceTestCase.java | 33 -- .../sca/samples/spring-bigbank-checkaccount/README | 4 - .../samples/spring-bigbank-checkaccount/build.xml | 73 --- .../samples/spring-bigbank-checkaccount/pom.xml | 133 ----- .../account/checking/CheckingAccountDetails.java | 50 -- .../account/checking/CheckingAccountService.java | 37 -- .../checking/CheckingAccountServiceImpl.java | 66 --- .../checking/server/CheckingAccountServer.java | 70 --- .../AccountsDataPasswordCallbackHandler.java | 54 -- .../account/security/BigbankCheckingsAcl.java | 48 -- ...ckingsDeptAuthImplementationPolicyProvider.java | 90 --- .../account/security/CheckingsDeptAuthPolicy.java | 46 -- .../CheckingsDeptAuthPolicyInterceptor.java | 73 --- .../CheckingsDeptAuthPolicyProviderFactory.java | 75 --- .../CheckingsDeptAuthorizationPolicyHandler.java | 67 --- .../CheckingsDeptAuthorizationPolicyProcessor.java | 72 --- .../src/main/resources/CheckingsAccount.composite | 41 -- ...ca.contribution.processor.StAXArtifactProcessor | 19 - ...rg.apache.tuscany.sca.policy.util.PolicyHandler | 20 - ...ache.tuscany.sca.provider.PolicyProviderFactory | 19 - .../src/main/resources/definitions.xml | 58 -- .../spring/CheckingAccountService-context.xml | 33 -- .../checkaccount/CheckAccountServiceTestCase.java | 33 -- java/sca/samples/spring-bigbank-stockquote/README | 4 - .../samples/spring-bigbank-stockquote/build.xml | 73 --- java/sca/samples/spring-bigbank-stockquote/pom.xml | 110 ---- .../java/bigbank/stockquote/StockQuoteImpl.java | 38 -- .../java/bigbank/stockquote/StockQuoteService.java | 30 - .../server/SCAApplicationContextProvider.java | 19 - .../stockquote/server/StockQuoteServer.java | 58 -- .../META-INF/spring/StockQuoteService-context.xml | 36 -- .../src/main/resources/StockQuote.composite | 35 -- .../stockquote/StockQuoteServiceTestCase.java | 33 -- java/sca/samples/store-distributed/README | 28 - java/sca/samples/store-distributed/build.xml | 79 --- java/sca/samples/store-distributed/cloud.composite | 27 - .../sca/samples/store-distributed/domain.composite | 27 - java/sca/samples/store-distributed/pom.xml | 119 ---- .../src/main/java/node/LaunchDomain.java | 33 -- .../src/main/java/node/LaunchStoreNodeA.java | 28 - .../src/main/java/node/LaunchStoreNodeB.java | 28 - .../src/main/java/node/LaunchStoreNodeC.java | 28 - .../src/main/java/services/Cart.java | 28 - .../src/main/java/services/Catalog.java | 27 - .../src/main/java/services/CurrencyConverter.java | 29 - .../main/java/services/CurrencyConverterImpl.java | 38 -- .../src/main/java/services/FruitsCatalogImpl.java | 52 -- .../src/main/java/services/Item.java | 51 -- .../src/main/java/services/ShoppingCartImpl.java | 112 ---- .../src/main/java/services/Total.java | 29 - .../src/main/resources/cloud/NodeA.composite | 36 -- .../src/main/resources/cloud/NodeB.composite | 36 -- .../src/main/resources/cloud/NodeC.composite | 36 -- .../resources/nodeA/META-INF/sca-contribution.xml | 24 - .../src/main/resources/nodeA/store.composite | 38 -- .../resources/nodeB/META-INF/sca-contribution.xml | 24 - .../src/main/resources/nodeB/store.composite | 35 -- .../resources/nodeC/META-INF/sca-contribution.xml | 24 - .../src/main/resources/nodeC/store.composite | 41 -- .../src/main/resources/nodeC/uiservices/store.html | 162 ----- .../src/main/resources/uiservices/store.html | 162 ----- java/sca/samples/store-distributed/store.png | Bin 15670 -> 0 bytes java/sca/samples/store-distributed/store.svg | 304 ---------- java/sca/samples/store-distributed/workspace.xml | 25 - java/sca/samples/store/README | 28 - java/sca/samples/store/build.xml | 79 --- java/sca/samples/store/pom.xml | 106 ---- .../samples/store/src/main/java/launch/Launch.java | 34 -- .../samples/store/src/main/java/services/Cart.java | 28 - .../store/src/main/java/services/Catalog.java | 27 - .../src/main/java/services/CurrencyConverter.java | 29 - .../main/java/services/CurrencyConverterImpl.java | 38 -- .../src/main/java/services/FruitsCatalogImpl.java | 52 -- .../samples/store/src/main/java/services/Item.java | 51 -- .../src/main/java/services/ShoppingCartImpl.java | 112 ---- .../store/src/main/java/services/Total.java | 29 - .../store/src/main/resources/store.composite | 64 -- .../store/src/main/resources/uiservices/store.html | 162 ----- java/sca/samples/store/store.png | Bin 15670 -> 0 bytes java/sca/samples/store/store.svg | 304 ---------- java/sca/samples/supplychain/README | 101 ---- java/sca/samples/supplychain/build.xml | 72 --- java/sca/samples/supplychain/pom.xml | 65 -- .../src/main/java/supplychain/Customer.java | 33 -- .../java/supplychain/CustomerComponentImpl.java | 44 -- .../src/main/java/supplychain/Retailer.java | 28 - .../java/supplychain/RetailerComponentImpl.java | 39 -- .../src/main/java/supplychain/Shipper.java | 28 - .../java/supplychain/ShipperComponentImpl.java | 39 -- .../main/java/supplychain/SupplyChainClient.java | 40 -- .../src/main/java/supplychain/Warehouse.java | 28 - .../java/supplychain/WarehouseComponentImpl.java | 39 -- .../src/main/resources/supplychain.composite | 45 -- .../supplychain/SupplyChainClientTestCase.java | 52 -- java/sca/samples/supplychain/supplychain.png | Bin 3898 -> 0 bytes java/sca/samples/supplychain/supplychain.svg | 228 ------- java/sca/samples/web-resource/README | 76 --- java/sca/samples/web-resource/build.xml | 72 --- java/sca/samples/web-resource/pom.xml | 79 --- .../src/main/java/web/resource/SampleServer.java | 44 -- .../src/main/resources/WebResource.composite | 32 - .../src/main/resources/myContent/index.html | 49 -- java/sca/samples/web-resource/web-resource.png | Bin 8418 -> 0 bytes java/sca/samples/web-resource/web-resource.svg | 197 ------ java/sca/samples/zipcode-jaxws/LICENSE | 205 ------- java/sca/samples/zipcode-jaxws/NOTICE | 6 - java/sca/samples/zipcode-jaxws/README | 72 --- java/sca/samples/zipcode-jaxws/build.xml | 68 --- java/sca/samples/zipcode-jaxws/pom.xml | 245 -------- .../java/com/example/uszip/GetInfoByAreaCode.java | 81 --- .../example/uszip/GetInfoByAreaCodeResponse.java | 158 ----- .../main/java/com/example/uszip/GetInfoByCity.java | 81 --- .../com/example/uszip/GetInfoByCityResponse.java | 158 ----- .../java/com/example/uszip/GetInfoByState.java | 81 --- .../com/example/uszip/GetInfoByStateResponse.java | 158 ----- .../main/java/com/example/uszip/GetInfoByZIP.java | 81 --- .../com/example/uszip/GetInfoByZIPResponse.java | 158 ----- .../main/java/com/example/uszip/ObjectFactory.java | 145 ----- .../src/main/java/com/example/uszip/USZip.java | 89 --- .../src/main/java/com/example/uszip/USZipSoap.java | 103 ---- .../main/java/com/example/uszip/package-info.java | 20 - .../com/example/weather/ArrayOfWeatherData.java | 87 --- .../com/example/weather/GetWeatherByPlaceName.java | 81 --- .../weather/GetWeatherByPlaceNameResponse.java | 81 --- .../com/example/weather/GetWeatherByZipCode.java | 81 --- .../weather/GetWeatherByZipCodeResponse.java | 81 --- .../java/com/example/weather/ObjectFactory.java | 118 ---- .../main/java/com/example/weather/WeatherData.java | 219 ------- .../java/com/example/weather/WeatherForecast.java | 91 --- .../com/example/weather/WeatherForecastSoap.java | 73 --- .../java/com/example/weather/WeatherForecasts.java | 251 -------- .../java/com/example/weather/package-info.java | 20 - .../src/main/java/location/LocationClient.java | 55 -- .../src/main/java/location/USLocationImpl.java | 56 -- .../main/java/weather/WeatherForecastClient.java | 60 -- .../src/main/java/weather/WeatherForecastImpl.java | 43 -- .../src/main/java/zipcode/ZipCodeClient.java | 38 -- .../src/main/java/zipcode/ZipCodeService.java | 30 - .../src/main/java/zipcode/ZipCodeServiceImpl.java | 82 --- .../src/main/resources/USLocation.composite | 30 - .../src/main/resources/WeatherForecast.composite | 30 - .../src/main/resources/ZipCode.composite | 33 -- .../test/java/zipcode/ZipCodeClientTestCase.java | 51 -- 2477 files changed, 76060 insertions(+), 77259 deletions(-) create mode 100644 java/sca/contrib/samples/binding-echo-extension/README create mode 100644 java/sca/contrib/samples/binding-echo-extension/build.xml create mode 100644 java/sca/contrib/samples/binding-echo-extension/pom.xml create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/Echo.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/resources/EchoBinding.composite create mode 100644 java/sca/contrib/samples/binding-echo-extension/src/test/resources/definitions.xml create mode 100644 java/sca/contrib/samples/binding-echo/README create mode 100644 java/sca/contrib/samples/binding-echo/binding-echo.png create mode 100644 java/sca/contrib/samples/binding-echo/binding-echo.svg create mode 100644 java/sca/contrib/samples/binding-echo/build.xml create mode 100644 java/sca/contrib/samples/binding-echo/pom.xml create mode 100644 java/sca/contrib/samples/binding-echo/src/main/java/echo/Echo.java create mode 100644 java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoBindingClient.java create mode 100644 java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java create mode 100644 java/sca/contrib/samples/binding-echo/src/main/resources/EchoBinding.composite create mode 100644 java/sca/contrib/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/README create mode 100644 java/sca/contrib/samples/binding-notification-broker/binding-notification-broker.png create mode 100644 java/sca/contrib/samples/binding-notification-broker/build.xml create mode 100644 java/sca/contrib/samples/binding-notification-broker/pom.xml create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite create mode 100644 java/sca/contrib/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl create mode 100644 java/sca/contrib/samples/binding-notification-consumer/README create mode 100644 java/sca/contrib/samples/binding-notification-consumer/binding-notification-consumer.png create mode 100644 java/sca/contrib/samples/binding-notification-consumer/build.xml create mode 100644 java/sca/contrib/samples/binding-notification-consumer/pom.xml create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl create mode 100644 java/sca/contrib/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java create mode 100644 java/sca/contrib/samples/binding-notification-producer/README create mode 100644 java/sca/contrib/samples/binding-notification-producer/binding-notification-producer.png create mode 100644 java/sca/contrib/samples/binding-notification-producer/build.xml create mode 100644 java/sca/contrib/samples/binding-notification-producer/pom.xml create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl create mode 100644 java/sca/contrib/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/README create mode 100644 java/sca/contrib/samples/calculator-corba-reference/pom.xml create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java create mode 100644 java/sca/contrib/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl create mode 100644 java/sca/contrib/samples/calculator-corba-service/README create mode 100644 java/sca/contrib/samples/calculator-corba-service/pom.xml create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java create mode 100644 java/sca/contrib/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl create mode 100644 java/sca/contrib/samples/calculator-distributed/README create mode 100644 java/sca/contrib/samples/calculator-distributed/build.xml create mode 100644 java/sca/contrib/samples/calculator-distributed/calculator-distributed.png create mode 100644 java/sca/contrib/samples/calculator-distributed/calculator-distributed.svg create mode 100644 java/sca/contrib/samples/calculator-distributed/cloud.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/domain.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/pom.xml create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java create mode 100644 java/sca/contrib/samples/calculator-distributed/workspace.xml create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/README create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/build.xml create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/calculator.png create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/calculator.svg create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/pom.xml create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java create mode 100644 java/sca/contrib/samples/calculator-lean/README create mode 100644 java/sca/contrib/samples/calculator-lean/calculator.png create mode 100644 java/sca/contrib/samples/calculator-lean/calculator.svg create mode 100644 java/sca/contrib/samples/calculator-lean/pom.xml create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-lean/src/main/resources/CalculatorTest.composite create mode 100644 java/sca/contrib/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java create mode 100644 java/sca/contrib/samples/calculator-rcp/build.properties create mode 100644 java/sca/contrib/samples/calculator-rcp/icons/alt_window_16.gif create mode 100644 java/sca/contrib/samples/calculator-rcp/icons/alt_window_32.gif create mode 100644 java/sca/contrib/samples/calculator-rcp/plugin.xml create mode 100644 java/sca/contrib/samples/calculator-rcp/pom.xml create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java create mode 100644 java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/View.java create mode 100644 java/sca/contrib/samples/calculator-script/README create mode 100644 java/sca/contrib/samples/calculator-script/build.xml create mode 100644 java/sca/contrib/samples/calculator-script/calculator-script.png create mode 100644 java/sca/contrib/samples/calculator-script/calculator-script.svg create mode 100644 java/sca/contrib/samples/calculator-script/pom.xml create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-script/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js create mode 100644 java/sca/contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy create mode 100644 java/sca/contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py create mode 100644 java/sca/contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb create mode 100644 java/sca/contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java create mode 100644 java/sca/contrib/samples/calculator-webapp/README create mode 100644 java/sca/contrib/samples/calculator-webapp/calculator-web.png create mode 100644 java/sca/contrib/samples/calculator-webapp/calculator-web.svg create mode 100644 java/sca/contrib/samples/calculator-webapp/pom.xml create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/calculator-webapp/src/main/webapp/calc.jsp create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/README create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.png create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.svg create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/pom.xml create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/security.properties create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/README create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/calculator-web.png create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/calculator-web.svg create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/pom.xml create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/calc.jsp create mode 100644 java/sca/contrib/samples/calculator2/README create mode 100644 java/sca/contrib/samples/calculator2/build.xml create mode 100644 java/sca/contrib/samples/calculator2/calculator.png create mode 100644 java/sca/contrib/samples/calculator2/calculator.svg create mode 100644 java/sca/contrib/samples/calculator2/pom.xml create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorClient.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/calculator2/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java create mode 100644 java/sca/contrib/samples/callback-ws-client/README create mode 100644 java/sca/contrib/samples/callback-ws-client/build.xml create mode 100644 java/sca/contrib/samples/callback-ws-client/callback-ws-client.png create mode 100644 java/sca/contrib/samples/callback-ws-client/callback-ws-client.svg create mode 100644 java/sca/contrib/samples/callback-ws-client/pom.xml create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClient.java create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyService.java create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/callback-ws-client/src/main/resources/myapp.composite create mode 100644 java/sca/contrib/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java create mode 100644 java/sca/contrib/samples/callback-ws-service/README create mode 100644 java/sca/contrib/samples/callback-ws-service/build.xml create mode 100644 java/sca/contrib/samples/callback-ws-service/callback-ws-service.png create mode 100644 java/sca/contrib/samples/callback-ws-service/callback-ws-service.svg create mode 100644 java/sca/contrib/samples/callback-ws-service/pom.xml create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyService.java create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/callback-ws-service/src/main/resources/callbackws.composite create mode 100644 java/sca/contrib/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java create mode 100644 java/sca/contrib/samples/callbacks-jms/README create mode 100644 java/sca/contrib/samples/callbacks-jms/build.xml create mode 100644 java/sca/contrib/samples/callbacks-jms/pom.xml create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderService.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/resources/callbacks.composite create mode 100644 java/sca/contrib/samples/callbacks-jms/src/main/resources/jndi.properties create mode 100644 java/sca/contrib/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java create mode 100644 java/sca/contrib/samples/chat-webapp/README create mode 100644 java/sca/contrib/samples/chat-webapp/chat-webapp.png create mode 100644 java/sca/contrib/samples/chat-webapp/chat-webapp.svg create mode 100644 java/sca/contrib/samples/chat-webapp/pom.xml create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatService.java create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/resources/chat.composite create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/chat-webapp/src/main/webapp/chat.html create mode 100644 java/sca/contrib/samples/chat2-webapp/README create mode 100644 java/sca/contrib/samples/chat2-webapp/build.xml create mode 100644 java/sca/contrib/samples/chat2-webapp/pom.xml create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatCallback.java create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatService.java create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/resources/chat.composite create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/chat2-webapp/src/main/webapp/chat.html create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/README create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/build-dojo.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/build.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/customer.sql create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/pom.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/Customer.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/java/launch/Launch.java create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/customer.composite create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/customer.jsp create mode 100644 java/sca/contrib/samples/customer-dojo/README create mode 100644 java/sca/contrib/samples/customer-dojo/build-dojo.xml create mode 100644 java/sca/contrib/samples/customer-dojo/build.xml create mode 100644 java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.png create mode 100644 java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.svg create mode 100644 java/sca/contrib/samples/customer-dojo/customer.sql create mode 100644 java/sca/contrib/samples/customer-dojo/pom.xml create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/customer/Customer.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollection.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerService.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/java/launch/Launch.java create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/orm.xml create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/persistence.xml create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/resources/content/customer.html create mode 100644 java/sca/contrib/samples/customer-dojo/src/main/resources/customer.composite create mode 100644 java/sca/contrib/samples/databinding-echo/README create mode 100644 java/sca/contrib/samples/databinding-echo/build.xml create mode 100644 java/sca/contrib/samples/databinding-echo/databinding-echo.png create mode 100644 java/sca/contrib/samples/databinding-echo/databinding-echo.svg create mode 100644 java/sca/contrib/samples/databinding-echo/pom.xml create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Echo.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface1.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface2.java create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/resources/EchoDataBinding.composite create mode 100644 java/sca/contrib/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl create mode 100644 java/sca/contrib/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java create mode 100644 java/sca/contrib/samples/domain-management/README create mode 100644 java/sca/contrib/samples/domain-management/pom.xml create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeComponents.java create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/ListComponents.java create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/ListDependencies.java create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/ListDeployables.java create mode 100644 java/sca/contrib/samples/domain-management/src/main/java/manager/WireComponents.java create mode 100644 java/sca/contrib/samples/domain-management/src/test/java/services/Cart.java create mode 100644 java/sca/contrib/samples/domain-management/src/test/java/services/Item.java create mode 100644 java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java create mode 100644 java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartImpl.java create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/assembly/assets.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/assembly/client.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/assembly/store.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/client/client.composite create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/domain-management/src/test/resources/store/store.composite create mode 100644 java/sca/contrib/samples/domain-webapp/README create mode 100644 java/sca/contrib/samples/domain-webapp/build.xml create mode 100644 java/sca/contrib/samples/domain-webapp/pom.xml create mode 100644 java/sca/contrib/samples/domain-webapp/src/main/java/node/DomainServer.java create mode 100755 java/sca/contrib/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/domain-webapp/src/main/resources/domain.composite create mode 100644 java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/index.html create mode 100644 java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/node.png create mode 100644 java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/style.css create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/README create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.png create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/pom.xml create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/index.html create mode 100644 java/sca/contrib/samples/feed-aggregator/README create mode 100644 java/sca/contrib/samples/feed-aggregator/build.xml create mode 100644 java/sca/contrib/samples/feed-aggregator/feed-aggregator.png create mode 100644 java/sca/contrib/samples/feed-aggregator/feed-aggregator.svg create mode 100644 java/sca/contrib/samples/feed-aggregator/pom.xml create mode 100644 java/sca/contrib/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java create mode 100644 java/sca/contrib/samples/feed-aggregator/src/main/java/feed/Sort.java create mode 100644 java/sca/contrib/samples/feed-aggregator/src/main/java/feed/SortImpl.java create mode 100644 java/sca/contrib/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java create mode 100644 java/sca/contrib/samples/feed-aggregator/src/main/resources/FeedAggregator.composite create mode 100644 java/sca/contrib/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/README create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/build.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.png create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.svg create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/deploy.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/log4j.properties create mode 100644 java/sca/contrib/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-bpel/README create mode 100644 java/sca/contrib/samples/helloworld-bpel/build.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.png create mode 100644 java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.svg create mode 100644 java/sca/contrib/samples/helloworld-bpel/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/deploy.xml create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.bpel create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.componentType create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.composite create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/main/resources/log4j.properties create mode 100644 java/sca/contrib/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-distributed/README create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-node/README create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-node/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/build.xml create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/build-dojo.xml create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/build.xml create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/style.css create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css create mode 100644 java/sca/contrib/samples/helloworld-jsp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java create mode 100644 java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite create mode 100644 java/sca/contrib/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-jsp/src/main/webapp/hello.jsp create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/README create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/build.xml create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.png create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.svg create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-service-jms/README create mode 100644 java/sca/contrib/samples/helloworld-service-jms/build.xml create mode 100644 java/sca/contrib/samples/helloworld-service-jms/helloworld-service.png create mode 100644 java/sca/contrib/samples/helloworld-service-jms/helloworld-service.svg create mode 100644 java/sca/contrib/samples/helloworld-service-jms/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java create mode 100644 java/sca/contrib/samples/helloworld-servlet/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-servlet/src/main/webapp/hello.html create mode 100644 java/sca/contrib/samples/helloworld-web-callback/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/hello.html create mode 100644 java/sca/contrib/samples/helloworld-web/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldService.java create mode 100644 java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite create mode 100644 java/sca/contrib/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-web/src/main/webapp/hello.html create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/README create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/README create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/README create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/README create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.png create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/README create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.png create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/logging.properties create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/README create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.png create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/README create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/README create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service/README create mode 100644 java/sca/contrib/samples/helloworld-ws-service/build.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.png create mode 100644 java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.svg create mode 100644 java/sca/contrib/samples/helloworld-ws-service/pom.xml create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl create mode 100644 java/sca/contrib/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/README create mode 100644 java/sca/contrib/samples/host-webapp-calculator/build.xml create mode 100644 java/sca/contrib/samples/host-webapp-calculator/calculator-web.png create mode 100644 java/sca/contrib/samples/host-webapp-calculator/calculator-web.svg create mode 100644 java/sca/contrib/samples/host-webapp-calculator/pom.xml create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddService.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/calc.jsp create mode 100644 java/sca/contrib/samples/implementation-composite/README create mode 100644 java/sca/contrib/samples/implementation-composite/build.xml create mode 100644 java/sca/contrib/samples/implementation-composite/implementation-composite.png create mode 100644 java/sca/contrib/samples/implementation-composite/implementation-composite.svg create mode 100644 java/sca/contrib/samples/implementation-composite/pom.xml create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/CompositeClient.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/Source.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceCallback.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceImpl.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/Target.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/java/composite/TargetImpl.java create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite.composite create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite2.composite create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/implementation-composite/src/main/resources/OuterComposite.composite create mode 100644 java/sca/contrib/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/README create mode 100644 java/sca/contrib/samples/implementation-crud-extension/build.xml create mode 100644 java/sca/contrib/samples/implementation-crud-extension/pom.xml create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUD.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java create mode 100644 java/sca/contrib/samples/implementation-crud-extension/src/test/resources/crud.composite create mode 100644 java/sca/contrib/samples/implementation-crud/README create mode 100644 java/sca/contrib/samples/implementation-crud/build.xml create mode 100644 java/sca/contrib/samples/implementation-crud/implementation-crud.png create mode 100644 java/sca/contrib/samples/implementation-crud/implementation-crud.svg create mode 100644 java/sca/contrib/samples/implementation-crud/pom.xml create mode 100644 java/sca/contrib/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java create mode 100644 java/sca/contrib/samples/implementation-crud/src/main/resources/crud.composite create mode 100644 java/sca/contrib/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java create mode 100644 java/sca/contrib/samples/implementation-notification/README create mode 100644 java/sca/contrib/samples/implementation-notification/build.xml create mode 100644 java/sca/contrib/samples/implementation-notification/implementation-notification.png create mode 100644 java/sca/contrib/samples/implementation-notification/pom.xml create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType create mode 100644 java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite create mode 100644 java/sca/contrib/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java create mode 100644 java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType create mode 100644 java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/README create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/build.xml create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/pom.xml create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType create mode 100644 java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite create mode 100644 java/sca/contrib/samples/loanapplication/pom.xml create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClient.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanService.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java create mode 100644 java/sca/contrib/samples/loanapplication/src/main/resources/loanapplication.composite create mode 100644 java/sca/contrib/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/README create mode 100644 java/sca/contrib/samples/osgi-supplychain/build-bundles.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/build.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.png create mode 100644 java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.svg create mode 100644 java/sca/contrib/samples/osgi-supplychain/pom.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/Customer.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSShipper.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/Retailer.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/Shipper.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/Warehouse.componentType create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.composite create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite create mode 100644 java/sca/contrib/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java create mode 100644 java/sca/contrib/samples/photo-gallery/README create mode 100644 java/sca/contrib/samples/photo-gallery/build.xml create mode 100644 java/sca/contrib/samples/photo-gallery/photo-gallery.png create mode 100644 java/sca/contrib/samples/photo-gallery/photo-gallery.svg create mode 100644 java/sca/contrib/samples/photo-gallery/pom.xml create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGallery.java create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/java/services/Album.java create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/java/services/AlbumImpl.java create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery.html create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/index.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/index_on.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/next.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/next_disabled.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/next_on.gif create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery.composite create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/prev.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/prev_disabled.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/prev_on.gif create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/show_slide.gif create mode 100644 java/sca/contrib/samples/photo-gallery/src/main/resources/space.gif create mode 100755 java/sca/contrib/samples/photo-gallery/src/main/resources/styles.css create mode 100644 java/sca/contrib/samples/quote-xquery/README create mode 100644 java/sca/contrib/samples/quote-xquery/build.xml create mode 100644 java/sca/contrib/samples/quote-xquery/pom.xml create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotews.composite create mode 100644 java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite create mode 100644 java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java create mode 100644 java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/README create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/build-dojo.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/build.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/pom.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.png create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.svg create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/BigBank.composite create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/web/style.css create mode 100644 java/sca/contrib/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java create mode 100644 java/sca/contrib/samples/simple-bigbank/README create mode 100644 java/sca/contrib/samples/simple-bigbank/build.xml create mode 100644 java/sca/contrib/samples/simple-bigbank/pom.xml create mode 100644 java/sca/contrib/samples/simple-bigbank/simple-bigbank.png create mode 100644 java/sca/contrib/samples/simple-bigbank/simple-bigbank.svg create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/resources/Account.composite create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/resources/BigBank.composite create mode 100644 java/sca/contrib/samples/simple-bigbank/src/main/resources/StockQuote.composite create mode 100644 java/sca/contrib/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/README create mode 100644 java/sca/contrib/samples/simple-callback-ws/build.xml create mode 100644 java/sca/contrib/samples/simple-callback-ws/pom.xml create mode 100644 java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.png create mode 100644 java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.svg create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/resources/simplecallback.composite create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl create mode 100644 java/sca/contrib/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java create mode 100644 java/sca/contrib/samples/simple-callback/README create mode 100644 java/sca/contrib/samples/simple-callback/build.xml create mode 100644 java/sca/contrib/samples/simple-callback/pom.xml create mode 100644 java/sca/contrib/samples/simple-callback/simple-callback.png create mode 100644 java/sca/contrib/samples/simple-callback/simple-callback.svg create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClient.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyService.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java create mode 100644 java/sca/contrib/samples/simple-callback/src/main/resources/simplecallback.composite create mode 100644 java/sca/contrib/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/pom.xml create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java create mode 100644 java/sca/contrib/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/README create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/build.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/pom.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb create mode 100644 java/sca/contrib/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/README create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/build.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/pom.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/README create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/build.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/pom.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite create mode 100644 java/sca/contrib/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java create mode 100644 java/sca/contrib/samples/store-distributed/README create mode 100644 java/sca/contrib/samples/store-distributed/build.xml create mode 100644 java/sca/contrib/samples/store-distributed/cloud.composite create mode 100644 java/sca/contrib/samples/store-distributed/domain.composite create mode 100644 java/sca/contrib/samples/store-distributed/pom.xml create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchDomain.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/Cart.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/Catalog.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverter.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/Item.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/java/services/Total.java create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeA.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeB.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeC.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/store.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/store.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/store.composite create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html create mode 100644 java/sca/contrib/samples/store-distributed/src/main/resources/uiservices/store.html create mode 100644 java/sca/contrib/samples/store-distributed/store.png create mode 100644 java/sca/contrib/samples/store-distributed/store.svg create mode 100644 java/sca/contrib/samples/store-distributed/workspace.xml create mode 100644 java/sca/contrib/samples/store/README create mode 100644 java/sca/contrib/samples/store/build.xml create mode 100644 java/sca/contrib/samples/store/pom.xml create mode 100644 java/sca/contrib/samples/store/src/main/java/launch/Launch.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/Cart.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/Catalog.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/CurrencyConverter.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/CurrencyConverterImpl.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/FruitsCatalogImpl.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/Item.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/ShoppingCartImpl.java create mode 100644 java/sca/contrib/samples/store/src/main/java/services/Total.java create mode 100644 java/sca/contrib/samples/store/src/main/resources/store.composite create mode 100644 java/sca/contrib/samples/store/src/main/resources/uiservices/store.html create mode 100644 java/sca/contrib/samples/store/store.png create mode 100644 java/sca/contrib/samples/store/store.svg create mode 100644 java/sca/contrib/samples/supplychain/README create mode 100644 java/sca/contrib/samples/supplychain/build.xml create mode 100644 java/sca/contrib/samples/supplychain/pom.xml create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/Customer.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/Retailer.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/Shipper.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/Warehouse.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java create mode 100644 java/sca/contrib/samples/supplychain/src/main/resources/supplychain.composite create mode 100644 java/sca/contrib/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java create mode 100644 java/sca/contrib/samples/supplychain/supplychain.png create mode 100644 java/sca/contrib/samples/supplychain/supplychain.svg create mode 100644 java/sca/contrib/samples/web-resource/README create mode 100644 java/sca/contrib/samples/web-resource/build.xml create mode 100644 java/sca/contrib/samples/web-resource/pom.xml create mode 100644 java/sca/contrib/samples/web-resource/src/main/java/web/resource/SampleServer.java create mode 100644 java/sca/contrib/samples/web-resource/src/main/resources/WebResource.composite create mode 100644 java/sca/contrib/samples/web-resource/src/main/resources/myContent/index.html create mode 100644 java/sca/contrib/samples/web-resource/web-resource.png create mode 100644 java/sca/contrib/samples/web-resource/web-resource.svg create mode 100644 java/sca/contrib/samples/zipcode-jaxws/LICENSE create mode 100644 java/sca/contrib/samples/zipcode-jaxws/NOTICE create mode 100644 java/sca/contrib/samples/zipcode-jaxws/README create mode 100644 java/sca/contrib/samples/zipcode-jaxws/build.xml create mode 100644 java/sca/contrib/samples/zipcode-jaxws/pom.xml create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/LocationClient.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/resources/USLocation.composite create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/main/resources/ZipCode.composite create mode 100644 java/sca/contrib/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java delete mode 100644 java/sca/samples/binding-echo-extension/README delete mode 100644 java/sca/samples/binding-echo-extension/build.xml delete mode 100644 java/sca/samples/binding-echo-extension/pom.xml delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java delete mode 100644 java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory delete mode 100644 java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory delete mode 100644 java/sca/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd delete mode 100644 java/sca/samples/binding-echo-extension/src/test/java/echo/Echo.java delete mode 100644 java/sca/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java delete mode 100644 java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java delete mode 100644 java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java delete mode 100644 java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite delete mode 100644 java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml delete mode 100644 java/sca/samples/binding-echo/README delete mode 100644 java/sca/samples/binding-echo/binding-echo.png delete mode 100644 java/sca/samples/binding-echo/binding-echo.svg delete mode 100644 java/sca/samples/binding-echo/build.xml delete mode 100644 java/sca/samples/binding-echo/pom.xml delete mode 100644 java/sca/samples/binding-echo/src/main/java/echo/Echo.java delete mode 100644 java/sca/samples/binding-echo/src/main/java/echo/EchoBindingClient.java delete mode 100644 java/sca/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java delete mode 100644 java/sca/samples/binding-echo/src/main/resources/EchoBinding.composite delete mode 100644 java/sca/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java delete mode 100644 java/sca/samples/binding-notification-broker/README delete mode 100644 java/sca/samples/binding-notification-broker/binding-notification-broker.png delete mode 100644 java/sca/samples/binding-notification-broker/build.xml delete mode 100644 java/sca/samples/binding-notification-broker/pom.xml delete mode 100644 java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java delete mode 100644 java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java delete mode 100644 java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java delete mode 100644 java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java delete mode 100644 java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java delete mode 100644 java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType delete mode 100644 java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite delete mode 100644 java/sca/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl delete mode 100644 java/sca/samples/binding-notification-consumer/README delete mode 100644 java/sca/samples/binding-notification-consumer/binding-notification-consumer.png delete mode 100644 java/sca/samples/binding-notification-consumer/build.xml delete mode 100644 java/sca/samples/binding-notification-consumer/pom.xml delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite delete mode 100644 java/sca/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl delete mode 100644 java/sca/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java delete mode 100644 java/sca/samples/binding-notification-producer/README delete mode 100644 java/sca/samples/binding-notification-producer/binding-notification-producer.png delete mode 100644 java/sca/samples/binding-notification-producer/build.xml delete mode 100644 java/sca/samples/binding-notification-producer/pom.xml delete mode 100644 java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java delete mode 100644 java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java delete mode 100644 java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java delete mode 100644 java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java delete mode 100644 java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType delete mode 100644 java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite delete mode 100644 java/sca/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl delete mode 100644 java/sca/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java delete mode 100644 java/sca/samples/calculator-corba-reference/README delete mode 100644 java/sca/samples/calculator-corba-reference/pom.xml delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java delete mode 100644 java/sca/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl delete mode 100644 java/sca/samples/calculator-corba-service/README delete mode 100644 java/sca/samples/calculator-corba-service/pom.xml delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java delete mode 100644 java/sca/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl delete mode 100644 java/sca/samples/calculator-distributed/README delete mode 100644 java/sca/samples/calculator-distributed/build.xml delete mode 100644 java/sca/samples/calculator-distributed/calculator-distributed.png delete mode 100644 java/sca/samples/calculator-distributed/calculator-distributed.svg delete mode 100644 java/sca/samples/calculator-distributed/cloud.composite delete mode 100644 java/sca/samples/calculator-distributed/domain.composite delete mode 100644 java/sca/samples/calculator-distributed/pom.xml delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/java/node/LaunchDomain.java delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite delete mode 100644 java/sca/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java delete mode 100644 java/sca/samples/calculator-distributed/workspace.xml delete mode 100644 java/sca/samples/calculator-equinox/README delete mode 100644 java/sca/samples/calculator-equinox/build.xml delete mode 100644 java/sca/samples/calculator-equinox/calculator.png delete mode 100644 java/sca/samples/calculator-equinox/calculator.svg delete mode 100644 java/sca/samples/calculator-equinox/pom.xml delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-equinox/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 java/sca/samples/calculator-implementation-policies/README delete mode 100644 java/sca/samples/calculator-implementation-policies/build.xml delete mode 100644 java/sca/samples/calculator-implementation-policies/calculator.png delete mode 100644 java/sca/samples/calculator-implementation-policies/calculator.svg delete mode 100644 java/sca/samples/calculator-implementation-policies/pom.xml delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties delete mode 100644 java/sca/samples/calculator-implementation-policies/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 java/sca/samples/calculator-lean/README delete mode 100644 java/sca/samples/calculator-lean/calculator.png delete mode 100644 java/sca/samples/calculator-lean/calculator.svg delete mode 100644 java/sca/samples/calculator-lean/pom.xml delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-lean/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-lean/src/main/resources/CalculatorTest.composite delete mode 100644 java/sca/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 java/sca/samples/calculator-rcp/build.properties delete mode 100644 java/sca/samples/calculator-rcp/icons/alt_window_16.gif delete mode 100644 java/sca/samples/calculator-rcp/icons/alt_window_32.gif delete mode 100644 java/sca/samples/calculator-rcp/plugin.xml delete mode 100644 java/sca/samples/calculator-rcp/pom.xml delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/Calculator.composite delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java delete mode 100644 java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/View.java delete mode 100644 java/sca/samples/calculator-script/README delete mode 100644 java/sca/samples/calculator-script/build.xml delete mode 100644 java/sca/samples/calculator-script/calculator-script.png delete mode 100644 java/sca/samples/calculator-script/calculator-script.svg delete mode 100644 java/sca/samples/calculator-script/pom.xml delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-script/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-script/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js delete mode 100644 java/sca/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy delete mode 100644 java/sca/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py delete mode 100644 java/sca/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb delete mode 100644 java/sca/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 java/sca/samples/calculator-webapp/README delete mode 100644 java/sca/samples/calculator-webapp/calculator-web.png delete mode 100644 java/sca/samples/calculator-webapp/calculator-web.svg delete mode 100644 java/sca/samples/calculator-webapp/pom.xml delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite delete mode 100644 java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/calculator-webapp/src/main/webapp/calc.jsp delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/README delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/calculator-web.png delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/calculator-web.svg delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/pom.xml delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/resources/security.properties delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp delete mode 100644 java/sca/samples/calculator-ws-webapp/README delete mode 100644 java/sca/samples/calculator-ws-webapp/calculator-web.png delete mode 100644 java/sca/samples/calculator-ws-webapp/calculator-web.svg delete mode 100644 java/sca/samples/calculator-ws-webapp/pom.xml delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/calculator-ws-webapp/src/main/webapp/calc.jsp delete mode 100644 java/sca/samples/calculator2/README delete mode 100644 java/sca/samples/calculator2/build.xml delete mode 100644 java/sca/samples/calculator2/calculator.png delete mode 100644 java/sca/samples/calculator2/calculator.svg delete mode 100644 java/sca/samples/calculator2/pom.xml delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/CalculatorClient.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/calculator2/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 java/sca/samples/callback-ws-client/README delete mode 100644 java/sca/samples/callback-ws-client/build.xml delete mode 100644 java/sca/samples/callback-ws-client/callback-ws-client.png delete mode 100644 java/sca/samples/callback-ws-client/callback-ws-client.svg delete mode 100644 java/sca/samples/callback-ws-client/pom.xml delete mode 100644 java/sca/samples/callback-ws-client/src/main/java/myapp/MyClient.java delete mode 100644 java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java delete mode 100644 java/sca/samples/callback-ws-client/src/main/java/myserver/MyService.java delete mode 100644 java/sca/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java delete mode 100644 java/sca/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/callback-ws-client/src/main/resources/myapp.composite delete mode 100644 java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java delete mode 100644 java/sca/samples/callback-ws-service/README delete mode 100644 java/sca/samples/callback-ws-service/build.xml delete mode 100644 java/sca/samples/callback-ws-service/callback-ws-service.png delete mode 100644 java/sca/samples/callback-ws-service/callback-ws-service.svg delete mode 100644 java/sca/samples/callback-ws-service/pom.xml delete mode 100644 java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java delete mode 100644 java/sca/samples/callback-ws-service/src/main/java/myserver/MyService.java delete mode 100644 java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java delete mode 100644 java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java delete mode 100644 java/sca/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/callback-ws-service/src/main/resources/callbackws.composite delete mode 100644 java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java delete mode 100644 java/sca/samples/callbacks-jms/README delete mode 100644 java/sca/samples/callbacks-jms/build.xml delete mode 100644 java/sca/samples/callbacks-jms/pom.xml delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderService.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java delete mode 100644 java/sca/samples/callbacks-jms/src/main/resources/callbacks.composite delete mode 100644 java/sca/samples/callbacks-jms/src/main/resources/jndi.properties delete mode 100644 java/sca/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java delete mode 100644 java/sca/samples/chat-webapp/README delete mode 100644 java/sca/samples/chat-webapp/chat-webapp.png delete mode 100644 java/sca/samples/chat-webapp/chat-webapp.svg delete mode 100644 java/sca/samples/chat-webapp/pom.xml delete mode 100644 java/sca/samples/chat-webapp/src/main/java/sample/ChatService.java delete mode 100644 java/sca/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java delete mode 100644 java/sca/samples/chat-webapp/src/main/resources/chat.composite delete mode 100644 java/sca/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/chat-webapp/src/main/webapp/chat.html delete mode 100644 java/sca/samples/chat2-webapp/README delete mode 100644 java/sca/samples/chat2-webapp/build.xml delete mode 100644 java/sca/samples/chat2-webapp/pom.xml delete mode 100644 java/sca/samples/chat2-webapp/src/main/java/sample/ChatCallback.java delete mode 100644 java/sca/samples/chat2-webapp/src/main/java/sample/ChatService.java delete mode 100644 java/sca/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java delete mode 100644 java/sca/samples/chat2-webapp/src/main/resources/chat.composite delete mode 100644 java/sca/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/chat2-webapp/src/main/webapp/chat.html delete mode 100644 java/sca/samples/customer-dojo-webapp/README delete mode 100644 java/sca/samples/customer-dojo-webapp/build-dojo.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/build.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png delete mode 100644 java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg delete mode 100644 java/sca/samples/customer-dojo-webapp/customer.sql delete mode 100644 java/sca/samples/customer-dojo-webapp/pom.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp delete mode 100644 java/sca/samples/customer-dojo/README delete mode 100644 java/sca/samples/customer-dojo/build-dojo.xml delete mode 100644 java/sca/samples/customer-dojo/build.xml delete mode 100644 java/sca/samples/customer-dojo/customer-dojo-jsonrpc.png delete mode 100644 java/sca/samples/customer-dojo/customer-dojo-jsonrpc.svg delete mode 100644 java/sca/samples/customer-dojo/customer.sql delete mode 100644 java/sca/samples/customer-dojo/pom.xml delete mode 100644 java/sca/samples/customer-dojo/src/main/java/customer/Customer.java delete mode 100644 java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollection.java delete mode 100644 java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java delete mode 100644 java/sca/samples/customer-dojo/src/main/java/customer/CustomerService.java delete mode 100644 java/sca/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java delete mode 100644 java/sca/samples/customer-dojo/src/main/java/launch/Launch.java delete mode 100644 java/sca/samples/customer-dojo/src/main/resources/META-INF/orm.xml delete mode 100644 java/sca/samples/customer-dojo/src/main/resources/META-INF/persistence.xml delete mode 100644 java/sca/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/customer-dojo/src/main/resources/content/customer.html delete mode 100644 java/sca/samples/customer-dojo/src/main/resources/customer.composite delete mode 100644 java/sca/samples/databinding-echo/README delete mode 100644 java/sca/samples/databinding-echo/build.xml delete mode 100644 java/sca/samples/databinding-echo/databinding-echo.png delete mode 100644 java/sca/samples/databinding-echo/databinding-echo.svg delete mode 100644 java/sca/samples/databinding-echo/pom.xml delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/Echo.java delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/Interface1.java delete mode 100644 java/sca/samples/databinding-echo/src/main/java/dbecho/Interface2.java delete mode 100644 java/sca/samples/databinding-echo/src/main/resources/EchoDataBinding.composite delete mode 100644 java/sca/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl delete mode 100644 java/sca/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java delete mode 100644 java/sca/samples/domain-management/README delete mode 100644 java/sca/samples/domain-management/pom.xml delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/DistributeComponents.java delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/ListComponents.java delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/ListDependencies.java delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/ListDeployables.java delete mode 100644 java/sca/samples/domain-management/src/main/java/manager/WireComponents.java delete mode 100644 java/sca/samples/domain-management/src/test/java/services/Cart.java delete mode 100644 java/sca/samples/domain-management/src/test/java/services/Item.java delete mode 100644 java/sca/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java delete mode 100644 java/sca/samples/domain-management/src/test/java/services/ShoppingCartImpl.java delete mode 100644 java/sca/samples/domain-management/src/test/resources/assembly/assets.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/assembly/client.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/assembly/store.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/client/client.composite delete mode 100644 java/sca/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/domain-management/src/test/resources/store/store.composite delete mode 100644 java/sca/samples/domain-webapp/README delete mode 100644 java/sca/samples/domain-webapp/build.xml delete mode 100644 java/sca/samples/domain-webapp/pom.xml delete mode 100644 java/sca/samples/domain-webapp/src/main/java/node/DomainServer.java delete mode 100755 java/sca/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/domain-webapp/src/main/resources/domain.composite delete mode 100644 java/sca/samples/domain-webapp/src/main/resources/webroot/index.html delete mode 100644 java/sca/samples/domain-webapp/src/main/resources/webroot/node.png delete mode 100644 java/sca/samples/domain-webapp/src/main/resources/webroot/style.css delete mode 100644 java/sca/samples/feed-aggregator-webapp/README delete mode 100644 java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.png delete mode 100644 java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg delete mode 100644 java/sca/samples/feed-aggregator-webapp/pom.xml delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/feed-aggregator-webapp/src/main/webapp/index.html delete mode 100644 java/sca/samples/feed-aggregator/README delete mode 100644 java/sca/samples/feed-aggregator/build.xml delete mode 100644 java/sca/samples/feed-aggregator/feed-aggregator.png delete mode 100644 java/sca/samples/feed-aggregator/feed-aggregator.svg delete mode 100644 java/sca/samples/feed-aggregator/pom.xml delete mode 100644 java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java delete mode 100644 java/sca/samples/feed-aggregator/src/main/java/feed/Sort.java delete mode 100644 java/sca/samples/feed-aggregator/src/main/java/feed/SortImpl.java delete mode 100644 java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java delete mode 100644 java/sca/samples/feed-aggregator/src/main/resources/FeedAggregator.composite delete mode 100644 java/sca/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java delete mode 100644 java/sca/samples/helloworld-bpel-ws/README delete mode 100644 java/sca/samples/helloworld-bpel-ws/build.xml delete mode 100644 java/sca/samples/helloworld-bpel-ws/helloworld-bpel.png delete mode 100644 java/sca/samples/helloworld-bpel-ws/helloworld-bpel.svg delete mode 100644 java/sca/samples/helloworld-bpel-ws/pom.xml delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/deploy.xml delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/main/resources/log4j.properties delete mode 100644 java/sca/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java delete mode 100644 java/sca/samples/helloworld-bpel/README delete mode 100644 java/sca/samples/helloworld-bpel/build.xml delete mode 100644 java/sca/samples/helloworld-bpel/helloworld-bpel.png delete mode 100644 java/sca/samples/helloworld-bpel/helloworld-bpel.svg delete mode 100644 java/sca/samples/helloworld-bpel/pom.xml delete mode 100644 java/sca/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/deploy.xml delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/helloworld.bpel delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/helloworld.componentType delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/helloworld.composite delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-bpel/src/main/resources/log4j.properties delete mode 100644 java/sca/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java delete mode 100644 java/sca/samples/helloworld-distributed/README delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-node/README delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-node/pom.xml delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/README delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/build.xml delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp delete mode 100644 java/sca/samples/helloworld-dojo-webapp/README delete mode 100644 java/sca/samples/helloworld-dojo-webapp/build-dojo.xml delete mode 100644 java/sca/samples/helloworld-dojo-webapp/build.xml delete mode 100644 java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png delete mode 100644 java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg delete mode 100644 java/sca/samples/helloworld-dojo-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-dojo-webapp/src/main/webapp/style.css delete mode 100644 java/sca/samples/helloworld-jms-webapp/README delete mode 100644 java/sca/samples/helloworld-jms-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/README delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css delete mode 100644 java/sca/samples/helloworld-jsp/pom.xml delete mode 100644 java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java delete mode 100644 java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite delete mode 100644 java/sca/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-jsp/src/main/webapp/hello.jsp delete mode 100644 java/sca/samples/helloworld-reference-jms/README delete mode 100644 java/sca/samples/helloworld-reference-jms/build.xml delete mode 100644 java/sca/samples/helloworld-reference-jms/helloworld-reference.png delete mode 100644 java/sca/samples/helloworld-reference-jms/helloworld-reference.svg delete mode 100644 java/sca/samples/helloworld-reference-jms/pom.xml delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java delete mode 100644 java/sca/samples/helloworld-service-jms/README delete mode 100644 java/sca/samples/helloworld-service-jms/build.xml delete mode 100644 java/sca/samples/helloworld-service-jms/helloworld-service.png delete mode 100644 java/sca/samples/helloworld-service-jms/helloworld-service.svg delete mode 100644 java/sca/samples/helloworld-service-jms/pom.xml delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite delete mode 100644 java/sca/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java delete mode 100644 java/sca/samples/helloworld-servlet/pom.xml delete mode 100644 java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java delete mode 100644 java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java delete mode 100644 java/sca/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite delete mode 100644 java/sca/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-servlet/src/main/webapp/hello.html delete mode 100644 java/sca/samples/helloworld-web-callback/pom.xml delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-web-callback/src/main/webapp/hello.html delete mode 100644 java/sca/samples/helloworld-web/pom.xml delete mode 100644 java/sca/samples/helloworld-web/src/main/java/sample/HelloworldService.java delete mode 100644 java/sca/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java delete mode 100644 java/sca/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite delete mode 100644 java/sca/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-web/src/main/webapp/hello.html delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/README delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/build.xml delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/README delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/build.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/README delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/README delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/build.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java delete mode 100644 java/sca/samples/helloworld-ws-reference/README delete mode 100644 java/sca/samples/helloworld-ws-reference/build.xml delete mode 100644 java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.png delete mode 100644 java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.svg delete mode 100644 java/sca/samples/helloworld-ws-reference/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/README delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/build.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo/README delete mode 100644 java/sca/samples/helloworld-ws-sdo/build.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.png delete mode 100644 java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg delete mode 100644 java/sca/samples/helloworld-ws-sdo/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/resources/logging.properties delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java delete mode 100644 java/sca/samples/helloworld-ws-service-jms/README delete mode 100644 java/sca/samples/helloworld-ws-service-jms/build.xml delete mode 100644 java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.png delete mode 100644 java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.svg delete mode 100644 java/sca/samples/helloworld-ws-service-jms/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-service-secure/README delete mode 100644 java/sca/samples/helloworld-ws-service-secure/build.xml delete mode 100644 java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png delete mode 100644 java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg delete mode 100644 java/sca/samples/helloworld-ws-service-secure/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/README delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/build.xml delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/helloworld-ws-service/README delete mode 100644 java/sca/samples/helloworld-ws-service/build.xml delete mode 100644 java/sca/samples/helloworld-ws-service/helloworld-ws-service.png delete mode 100644 java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg delete mode 100644 java/sca/samples/helloworld-ws-service/pom.xml delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl delete mode 100644 java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl delete mode 100644 java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java delete mode 100644 java/sca/samples/host-webapp-calculator/README delete mode 100644 java/sca/samples/host-webapp-calculator/build.xml delete mode 100644 java/sca/samples/host-webapp-calculator/calculator-web.png delete mode 100644 java/sca/samples/host-webapp-calculator/calculator-web.svg delete mode 100644 java/sca/samples/host-webapp-calculator/pom.xml delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddService.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml delete mode 100644 java/sca/samples/host-webapp-calculator/src/main/webapp/calc.jsp delete mode 100644 java/sca/samples/implementation-composite/README delete mode 100644 java/sca/samples/implementation-composite/build.xml delete mode 100644 java/sca/samples/implementation-composite/implementation-composite.png delete mode 100644 java/sca/samples/implementation-composite/implementation-composite.svg delete mode 100644 java/sca/samples/implementation-composite/pom.xml delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/CompositeClient.java delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/Source.java delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/SourceCallback.java delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/SourceImpl.java delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/Target.java delete mode 100644 java/sca/samples/implementation-composite/src/main/java/composite/TargetImpl.java delete mode 100644 java/sca/samples/implementation-composite/src/main/resources/InnerComposite.composite delete mode 100644 java/sca/samples/implementation-composite/src/main/resources/InnerComposite2.composite delete mode 100644 java/sca/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/implementation-composite/src/main/resources/OuterComposite.composite delete mode 100644 java/sca/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java delete mode 100644 java/sca/samples/implementation-crud-extension/README delete mode 100644 java/sca/samples/implementation-crud-extension/build.xml delete mode 100644 java/sca/samples/implementation-crud-extension/pom.xml delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUD.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory delete mode 100644 java/sca/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd delete mode 100644 java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java delete mode 100644 java/sca/samples/implementation-crud-extension/src/test/resources/crud.composite delete mode 100644 java/sca/samples/implementation-crud/README delete mode 100644 java/sca/samples/implementation-crud/build.xml delete mode 100644 java/sca/samples/implementation-crud/implementation-crud.png delete mode 100644 java/sca/samples/implementation-crud/implementation-crud.svg delete mode 100644 java/sca/samples/implementation-crud/pom.xml delete mode 100644 java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java delete mode 100644 java/sca/samples/implementation-crud/src/main/resources/crud.composite delete mode 100644 java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java delete mode 100644 java/sca/samples/implementation-notification/README delete mode 100644 java/sca/samples/implementation-notification/build.xml delete mode 100644 java/sca/samples/implementation-notification/implementation-notification.png delete mode 100644 java/sca/samples/implementation-notification/pom.xml delete mode 100644 java/sca/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java delete mode 100644 java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java delete mode 100644 java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java delete mode 100644 java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java delete mode 100644 java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java delete mode 100644 java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType delete mode 100644 java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite delete mode 100644 java/sca/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java delete mode 100644 java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType delete mode 100644 java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite delete mode 100644 java/sca/samples/implementation-pojo-extension/README delete mode 100644 java/sca/samples/implementation-pojo-extension/build.xml delete mode 100644 java/sca/samples/implementation-pojo-extension/pom.xml delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory delete mode 100644 java/sca/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType delete mode 100644 java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite delete mode 100644 java/sca/samples/loanapplication/pom.xml delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClient.java delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanService.java delete mode 100644 java/sca/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java delete mode 100644 java/sca/samples/loanapplication/src/main/resources/loanapplication.composite delete mode 100644 java/sca/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java delete mode 100644 java/sca/samples/osgi-supplychain/README delete mode 100644 java/sca/samples/osgi-supplychain/build-bundles.xml delete mode 100644 java/sca/samples/osgi-supplychain/build.xml delete mode 100644 java/sca/samples/osgi-supplychain/osgi-supplychain.png delete mode 100644 java/sca/samples/osgi-supplychain/osgi-supplychain.svg delete mode 100644 java/sca/samples/osgi-supplychain/pom.xml delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/Customer.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/DSShipper.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/Retailer.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/Shipper.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/Warehouse.componentType delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/supplychain.composite delete mode 100644 java/sca/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite delete mode 100644 java/sca/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java delete mode 100644 java/sca/samples/photo-gallery/README delete mode 100644 java/sca/samples/photo-gallery/build.xml delete mode 100644 java/sca/samples/photo-gallery/photo-gallery.png delete mode 100644 java/sca/samples/photo-gallery/photo-gallery.svg delete mode 100644 java/sca/samples/photo-gallery/pom.xml delete mode 100644 java/sca/samples/photo-gallery/src/main/java/launch/LaunchGallery.java delete mode 100644 java/sca/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java delete mode 100644 java/sca/samples/photo-gallery/src/main/java/services/Album.java delete mode 100644 java/sca/samples/photo-gallery/src/main/java/services/AlbumImpl.java delete mode 100644 java/sca/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery.html delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/index.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/index_on.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/next.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/next_disabled.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/next_on.gif delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/photo-gallery.composite delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/prev.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/prev_disabled.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/prev_on.gif delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/show_slide.gif delete mode 100644 java/sca/samples/photo-gallery/src/main/resources/space.gif delete mode 100755 java/sca/samples/photo-gallery/src/main/resources/styles.css delete mode 100644 java/sca/samples/quote-xquery/README delete mode 100644 java/sca/samples/quote-xquery/build.xml delete mode 100644 java/sca/samples/quote-xquery/pom.xml delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java delete mode 100644 java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/xqueryquotews.composite delete mode 100644 java/sca/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite delete mode 100644 java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java delete mode 100644 java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java delete mode 100644 java/sca/samples/simple-bigbank-spring/README delete mode 100644 java/sca/samples/simple-bigbank-spring/build-dojo.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/build.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/pom.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.png delete mode 100644 java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.svg delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/BigBank.composite delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml delete mode 100644 java/sca/samples/simple-bigbank-spring/src/main/resources/web/style.css delete mode 100644 java/sca/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java delete mode 100644 java/sca/samples/simple-bigbank/README delete mode 100644 java/sca/samples/simple-bigbank/build.xml delete mode 100644 java/sca/samples/simple-bigbank/pom.xml delete mode 100644 java/sca/samples/simple-bigbank/simple-bigbank.png delete mode 100644 java/sca/samples/simple-bigbank/simple-bigbank.svg delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java delete mode 100644 java/sca/samples/simple-bigbank/src/main/resources/Account.composite delete mode 100644 java/sca/samples/simple-bigbank/src/main/resources/BigBank.composite delete mode 100644 java/sca/samples/simple-bigbank/src/main/resources/StockQuote.composite delete mode 100644 java/sca/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java delete mode 100644 java/sca/samples/simple-callback-ws/README delete mode 100644 java/sca/samples/simple-callback-ws/build.xml delete mode 100644 java/sca/samples/simple-callback-ws/pom.xml delete mode 100644 java/sca/samples/simple-callback-ws/simple-callback-ws.png delete mode 100644 java/sca/samples/simple-callback-ws/simple-callback-ws.svg delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java delete mode 100644 java/sca/samples/simple-callback-ws/src/main/resources/simplecallback.composite delete mode 100644 java/sca/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl delete mode 100644 java/sca/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java delete mode 100644 java/sca/samples/simple-callback/README delete mode 100644 java/sca/samples/simple-callback/build.xml delete mode 100644 java/sca/samples/simple-callback/pom.xml delete mode 100644 java/sca/samples/simple-callback/simple-callback.png delete mode 100644 java/sca/samples/simple-callback/simple-callback.svg delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/MyClient.java delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/MyService.java delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java delete mode 100644 java/sca/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java delete mode 100644 java/sca/samples/simple-callback/src/main/resources/simplecallback.composite delete mode 100644 java/sca/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java delete mode 100644 java/sca/samples/spi-implementation-pojo/pom.xml delete mode 100644 java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator delete mode 100644 java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java delete mode 100644 java/sca/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite delete mode 100644 java/sca/samples/spring-bigbank-calculator/README delete mode 100644 java/sca/samples/spring-bigbank-calculator/build.xml delete mode 100644 java/sca/samples/spring-bigbank-calculator/pom.xml delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb delete mode 100644 java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/README delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/build.xml delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/pom.xml delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml delete mode 100644 java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java delete mode 100644 java/sca/samples/spring-bigbank-stockquote/README delete mode 100644 java/sca/samples/spring-bigbank-stockquote/build.xml delete mode 100644 java/sca/samples/spring-bigbank-stockquote/pom.xml delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite delete mode 100644 java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java delete mode 100644 java/sca/samples/store-distributed/README delete mode 100644 java/sca/samples/store-distributed/build.xml delete mode 100644 java/sca/samples/store-distributed/cloud.composite delete mode 100644 java/sca/samples/store-distributed/domain.composite delete mode 100644 java/sca/samples/store-distributed/pom.xml delete mode 100644 java/sca/samples/store-distributed/src/main/java/node/LaunchDomain.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/Cart.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/Catalog.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/CurrencyConverter.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/Item.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java delete mode 100644 java/sca/samples/store-distributed/src/main/java/services/Total.java delete mode 100644 java/sca/samples/store-distributed/src/main/resources/cloud/NodeA.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/cloud/NodeB.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/cloud/NodeC.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeA/store.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeB/store.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeC/store.composite delete mode 100644 java/sca/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html delete mode 100644 java/sca/samples/store-distributed/src/main/resources/uiservices/store.html delete mode 100644 java/sca/samples/store-distributed/store.png delete mode 100644 java/sca/samples/store-distributed/store.svg delete mode 100644 java/sca/samples/store-distributed/workspace.xml delete mode 100644 java/sca/samples/store/README delete mode 100644 java/sca/samples/store/build.xml delete mode 100644 java/sca/samples/store/pom.xml delete mode 100644 java/sca/samples/store/src/main/java/launch/Launch.java delete mode 100644 java/sca/samples/store/src/main/java/services/Cart.java delete mode 100644 java/sca/samples/store/src/main/java/services/Catalog.java delete mode 100644 java/sca/samples/store/src/main/java/services/CurrencyConverter.java delete mode 100644 java/sca/samples/store/src/main/java/services/CurrencyConverterImpl.java delete mode 100644 java/sca/samples/store/src/main/java/services/FruitsCatalogImpl.java delete mode 100644 java/sca/samples/store/src/main/java/services/Item.java delete mode 100644 java/sca/samples/store/src/main/java/services/ShoppingCartImpl.java delete mode 100644 java/sca/samples/store/src/main/java/services/Total.java delete mode 100644 java/sca/samples/store/src/main/resources/store.composite delete mode 100644 java/sca/samples/store/src/main/resources/uiservices/store.html delete mode 100644 java/sca/samples/store/store.png delete mode 100644 java/sca/samples/store/store.svg delete mode 100644 java/sca/samples/supplychain/README delete mode 100644 java/sca/samples/supplychain/build.xml delete mode 100644 java/sca/samples/supplychain/pom.xml delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/Customer.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/Retailer.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/Shipper.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/Warehouse.java delete mode 100644 java/sca/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java delete mode 100644 java/sca/samples/supplychain/src/main/resources/supplychain.composite delete mode 100644 java/sca/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java delete mode 100644 java/sca/samples/supplychain/supplychain.png delete mode 100644 java/sca/samples/supplychain/supplychain.svg delete mode 100644 java/sca/samples/web-resource/README delete mode 100644 java/sca/samples/web-resource/build.xml delete mode 100644 java/sca/samples/web-resource/pom.xml delete mode 100644 java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java delete mode 100644 java/sca/samples/web-resource/src/main/resources/WebResource.composite delete mode 100644 java/sca/samples/web-resource/src/main/resources/myContent/index.html delete mode 100644 java/sca/samples/web-resource/web-resource.png delete mode 100644 java/sca/samples/web-resource/web-resource.svg delete mode 100644 java/sca/samples/zipcode-jaxws/LICENSE delete mode 100644 java/sca/samples/zipcode-jaxws/NOTICE delete mode 100644 java/sca/samples/zipcode-jaxws/README delete mode 100644 java/sca/samples/zipcode-jaxws/build.xml delete mode 100644 java/sca/samples/zipcode-jaxws/pom.xml delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/location/LocationClient.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/resources/USLocation.composite delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite delete mode 100644 java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite delete mode 100644 java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java (limited to 'java/sca') diff --git a/java/sca/contrib/samples/binding-echo-extension/README b/java/sca/contrib/samples/binding-echo-extension/README new file mode 100644 index 0000000000..94716b151f --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/README @@ -0,0 +1,74 @@ +Binding Echo Sample +=================== +This sample demonstrates how new bindings are constructed for Apache Tuscany +SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you want to try out the echo binding that this sample provides +please see the binding-echo sample that provides the necessary client and +application code to bring up an application that uses this binding + +Sample Overview +--------------- +This sample contains a implementation of an SCA binding that simply echoes back +any messages that are sent to it. + +binding-echo-extension/ + src/ + main/ + java/ + echo/ - The binding interfaces + impl/ - The bindings model classes + provider/ - The bindings runtime classes + server/ - A dummy server that the binding is plugged into + resources/ + META-INF/ + services/ - The extension declaration + test/ + java/ + echo/ - test code + resources/ + EchoBinding.composite - the SCA assembly used by the unit test + build.xml - the Ant build file + pom.xml - the Maven build file + +Building The Sample Using Ant +----------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd binding-echo-extension +ant compile + +See the binding-echo sample to run a sample that uses this binding. + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd binding-echo-extension +mvn + +Maven will also test that the sample extension built properly. You should see +the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running echo.EchoServiceTestCase +Returned message: oof +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec +Running echo.EchoReferenceTestCase +Returned message: oof +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/binding-echo-extension/build.xml b/java/sca/contrib/samples/binding-echo-extension/build.xml new file mode 100644 index 0000000000..5df5981bea --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-echo-extension/pom.xml b/java/sca/contrib/samples/binding-echo-extension/pom.xml new file mode 100644 index 0000000000..5d5ba0865f --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-binding-echo-extension + Apache Tuscany SCA Echo Binding Extension Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java new file mode 100644 index 0000000000..3fe1598e0d --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo; + +import org.apache.tuscany.sca.assembly.Binding; + +/** + * A model for the sample Echo binding. + */ +public interface EchoBinding extends Binding { + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java new file mode 100644 index 0000000000..0f6fee82be --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo; + +/** + * A factory for the sample Echo binding model. + */ +public interface EchoBindingFactory { + + /** + * Creates a new Echo binding. + * + * @return a new Echo binding + */ + EchoBinding createEchoBinding(); +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java new file mode 100644 index 0000000000..af759dbf93 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.impl; + +import echo.EchoBinding; +import echo.EchoBindingFactory; + +/** + * A factory for the sample Echo binding model. + */ +public class EchoBindingFactoryImpl implements EchoBindingFactory { + + public EchoBinding createEchoBinding() { + return new EchoBindingImpl(); + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java new file mode 100644 index 0000000000..19c9271bb8 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.IntentAttachPointType; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; + +import echo.EchoBinding; + +/** + * Implementation of the Echo binding model. + */ +public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint { + + private String name; + private String uri; + private List requiredIntents = new ArrayList(); + private List policySets = new ArrayList(); + private List applicablePolicySets = new ArrayList(); + private IntentAttachPointType bindingType = null; + + public IntentAttachPointType getType() { + return bindingType; + } + + public void setType(IntentAttachPointType type) { + this.bindingType = type; + } + + public String getName() { + return name; + } + + public String getURI() { + return uri; + } + + public void setName(String name) { + this.name = name; + } + + public void setURI(String uri) { + this.uri = uri; + } + + public List getPolicySets() { + return policySets; + } + + public List getRequiredIntents() { + return requiredIntents; + } + + public boolean isUnresolved() { + // The sample binding is always resolved + return false; + } + + public void setUnresolved(boolean unresolved) { + // The sample binding is always resolved + } + + public void setPolicySets(List policySets) { + this.policySets = policySets; + + } + + public void setRequiredIntents(List intents) { + this.requiredIntents = intents; + + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public List getApplicablePolicySets() { + return this.applicablePolicySets; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java new file mode 100644 index 0000000000..45fdb73f67 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.policy.Intent; +import org.apache.tuscany.sca.policy.PolicyFactory; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.policy.IntentAttachPointType; +import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl; + +import echo.EchoBinding; +import echo.EchoBindingFactory; + +/** + * A processor for elements. + */ +public class EchoBindingProcessor implements StAXArtifactProcessor { + + private QName BINDING_ECHO = new QName("http://echo", "binding.echo"); + + private final EchoBindingFactory factory; + private PolicyAttachPointProcessor policyProcessor; + + public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) { + this.factory = factory; + this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); + } + + public QName getArtifactType() { + return BINDING_ECHO; + } + + public Class getModelType() { + return EchoBinding.class; + } + + public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + EchoBinding echoBinding = factory.createEchoBinding(); + IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType(); + bindingType.setName(getArtifactType()); + bindingType.setUnresolved(true); + ((PolicySetAttachPoint)echoBinding).setType(bindingType); + + String name = reader.getAttributeValue(null, "name"); + if (name != null) { + echoBinding.setName(name); + } + + String uri = reader.getAttributeValue(null, "uri"); + if (uri != null) { + echoBinding.setURI(uri); + } + + policyProcessor.readPolicies(echoBinding, reader); + + return echoBinding; + } + + public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { + + policyProcessor.writePolicyPrefixes(echoBinding, writer); + writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart()); + policyProcessor.writePolicyAttributes(echoBinding, writer); + + if (echoBinding.getName() != null) { + writer.writeAttribute("name", echoBinding.getName()); + } + + if (echoBinding.getURI() != null) { + writer.writeAttribute("uri", echoBinding.getURI()); + } + + writer.writeEndElement(); + } + + public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException { + PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding; + List requiredIntents = new ArrayList(); + Intent resolvedIntent = null; + for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) { + resolvedIntent = resolver.resolveModel(Intent.class, intent); + requiredIntents.add(resolvedIntent); + } + policySetAttachPoint.getRequiredIntents().clear(); + policySetAttachPoint.getRequiredIntents().addAll(requiredIntents); + + List resolvedPolicySets = new ArrayList(); + PolicySet resolvedPolicySet = null; + for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { + resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet); + resolvedPolicySets.add(resolvedPolicySet); + } + policySetAttachPoint.getPolicySets().clear(); + policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets); + } +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java new file mode 100644 index 0000000000..91697fcd9a --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider; + +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; + +/** + * Invoker for the sample echo binding. + */ +class EchoBindingInvoker implements Invoker { + + EchoBindingInvoker() { + } + + public Message invoke(Message msg) { + try { + System.out.println("Passing thro invoker..."); + Object[] args = msg.getBody(); + + // echo back the first parameter, a real binding would invoke some API for flowing the request + Object result = args[0]; + + msg.setBody(result); + + } catch (Exception e) { + msg.setFaultBody(e); + } + return msg; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java new file mode 100644 index 0000000000..4877bade7f --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; + +import echo.provider.policy.PolicyHandler; +import echo.provider.policy.EncryptionPolicyHandler; + +/** + * Invoker that applies policies before invocation for the sample echo binding. + */ +public class EchoBindingPoliciedInvoker implements Invoker { + List policies = null; + Map policyHandlers = new HashMap(); + + public EchoBindingPoliciedInvoker(List policies) { + this.policies = policies; + policyHandlers.put(new QName("http://test","EncryptionPolicy"), + new EncryptionPolicyHandler()); + } + + public Message invoke(Message msg) { + try { + Object[] args = msg.getBody(); + + applyPolicies(args); + + // echo back the first parameter, a real binding would invoke some API for flowing the request + Object result = args[0]; + + msg.setBody(result); + + } catch (Exception e) { + msg.setFaultBody(e); + } + return msg; + } + + private void applyPolicies(Object[] args) throws Exception { + for ( PolicySet policySet : policies ) { + PolicyHandler policyHandler = policyHandlers.get(policySet.getName()); + policyHandler.applyPolicy(args, policySet); + } + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java new file mode 100644 index 0000000000..ba74d8f99a --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.provider; + +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.BindingProviderFactory; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +import echo.EchoBinding; + + +/** + * Implementation of the Echo binding model. + */ +public class EchoBindingProviderFactory implements BindingProviderFactory { + + private MessageFactory messageFactory; + + public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) { + ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + this.messageFactory = factories.getFactory(MessageFactory.class); + } + + public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) { + return new EchoReferenceBindingProvider(component, reference, binding); + } + + public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) { + return new EchoServiceBindingProvider(component, service, binding, messageFactory); + } + + public Class getModelType() { + return EchoBinding.class; + } +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java new file mode 100644 index 0000000000..0efc319af9 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.provider; + +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.policy.PolicySetAttachPoint; +import org.apache.tuscany.sca.provider.ReferenceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; + +import echo.EchoBinding; + +/** + * Implementation of the Echo binding provider. + */ +class EchoReferenceBindingProvider implements ReferenceBindingProvider { + + private RuntimeComponentReference reference; + private EchoBinding binding; + + EchoReferenceBindingProvider(RuntimeComponent component, + RuntimeComponentReference reference, + EchoBinding binding) { + this.reference = reference; + this.binding = binding; + } + + public Invoker createInvoker(Operation operation) { + if (binding instanceof PolicySetAttachPoint) { + PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding; + if ( !policySetAttachPoint.getPolicySets().isEmpty() ){ + return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets()); + } + } + return new EchoBindingInvoker(); + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public InterfaceContract getBindingInterfaceContract() { + return reference.getInterfaceContract(); + } + + public void start() { + } + + public void stop() { + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java new file mode 100644 index 0000000000..1cd1e5af4e --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.provider; + +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.invocation.InvocationChain; +import org.apache.tuscany.sca.invocation.MessageFactory; +import org.apache.tuscany.sca.provider.ServiceBindingProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.apache.tuscany.sca.runtime.RuntimeWire; + +import echo.EchoBinding; +import echo.server.EchoServer; +import echo.server.EchoServiceListener; + +/** + * Implementation of the Echo binding provider. + */ +class EchoServiceBindingProvider implements ServiceBindingProvider { + + private RuntimeComponent component; + private RuntimeComponentService service; + private EchoBinding binding; + private MessageFactory messageFactory; + + EchoServiceBindingProvider(RuntimeComponent component, + RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) { + this.component = component; + this.service = service; + this.binding = binding; + this.messageFactory = messageFactory; + } + + public InterfaceContract getBindingInterfaceContract() { + return service.getInterfaceContract(); + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + + RuntimeComponentService componentService = (RuntimeComponentService) service; + RuntimeWire wire = componentService.getRuntimeWire(binding); + InvocationChain chain = wire.getInvocationChains().get(0); + + // Register with the hosting server + String uri = binding.getURI(); + EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory)); + } + + public void stop() { + + // Unregister from the hosting server + String uri = component.getURI() + "/" + binding.getName(); + EchoServer.getServer().unregister(uri); + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java new file mode 100644 index 0000000000..33dc761aa4 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +/** + */ +public class EchoBindingEncryptionPolicy extends EchoBindingPolicy { + + private String encryptionStrategyClassName; + private Class strategyClass; + + public String getEncryptionStrategyClassName() { + return encryptionStrategyClassName; + } + public void setEncryptionStrategyClassName(String encryptionStrategyClassName) { + this.encryptionStrategyClassName = encryptionStrategyClassName; + } + public Class getStrategyClass() { + return strategyClass; + } + public void setStrategyClass(Class strategy) { + this.strategyClass = strategy; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java new file mode 100644 index 0000000000..c847d088a6 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; + + +/** + * + */ +public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor { + + public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + } + + public Class getModelType() { + return EchoBindingEncryptionPolicy.class; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java new file mode 100644 index 0000000000..7d38e3b7a8 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.policy.Policy; + +/** + + */ +public class EchoBindingPolicy implements Policy { + private boolean unresolved = true; + + public QName getSchemaName() { + return new QName("http://sample/policy","echoBindingPolicy"); + } + + public boolean isUnresolved() { + return unresolved; + } + + public void setUnresolved(boolean unresolved) { + this.unresolved = unresolved; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java new file mode 100644 index 0000000000..72b8002238 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ClassReference; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; + +/** + * + */ +public abstract class EchoBindingPolicyProcessor implements StAXArtifactProcessor { + public static final String ENCRYPTION = "Encryption"; + + public QName getArtifactType() { + return new QName("http://sample/policy", "echoBindingPolicy"); + } + + public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + String name = reader.getAttributeValue(null, "name"); + if (name != null && name.equals(ENCRYPTION)) { + EchoBindingEncryptionPolicy policy = new EchoBindingEncryptionPolicy(); + policy.setEncryptionStrategyClassName(reader.getAttributeValue(null, "strategy")); + return (T)policy; + } + return null; + } + + public void write(T arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException { + } + + public void resolve(T policy, ModelResolver resolver) throws ContributionResolveException { + if (policy instanceof EchoBindingEncryptionPolicy) { + EchoBindingEncryptionPolicy ePolicy = (EchoBindingEncryptionPolicy)policy; + + ClassReference classReference = new ClassReference(ePolicy.getEncryptionStrategyClassName()); + classReference = resolver.resolveModel(ClassReference.class, classReference); + Class javaClass = classReference != null ? classReference.getJavaClass() : null; + if (javaClass == null) { + //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass())); + } + //ePolicy.setStrategyClass(javaClass); + //FIXME: need to resolve this thro resolver + try { + ePolicy.setStrategyClass((Class)Class.forName(ePolicy + .getEncryptionStrategyClassName())); + } catch (Exception e) { + throw new ContributionResolveException(e); + } + ePolicy.setStrategyClass(ePolicy.getStrategyClass()); + ePolicy.setUnresolved(false); + } + } +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java new file mode 100644 index 0000000000..deda8d9744 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import org.apache.tuscany.sca.policy.Policy; +import org.apache.tuscany.sca.policy.PolicySet; + +/** + * Sample policy handler + */ +public class EncryptionPolicyHandler implements PolicyHandler { + + public void applyPolicy(Object msg, PolicySet policySet) throws Exception { + for ( Object aPolicy : policySet.getPolicies() ) { + if ( aPolicy instanceof EchoBindingEncryptionPolicy ) { + encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy); + } + } + } + + private void encrypt(Object msg, EchoBindingEncryptionPolicy policy) throws Exception { + if ( !policy.isUnresolved() && msg instanceof Object[] ) { + EncryptionStrategy strategy = policy.getStrategyClass().newInstance(); + Object[] msgArgs = (Object[])msg; + for ( int count = 0 ; count < msgArgs.length ; ++count ) { + msgArgs[count] = strategy.encryptMessage(msgArgs[count]); + } + } + + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java new file mode 100644 index 0000000000..ffadfc7fff --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +/** + + */ +public interface EncryptionStrategy { + Object encryptMessage(Object msg); +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java new file mode 100644 index 0000000000..6fa5f26977 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import org.apache.tuscany.sca.policy.PolicySet; + +/** + * Sample Policy Handler Interface + * + */ +public interface PolicyHandler { + void applyPolicy(Object msg, PolicySet policySet) throws Exception; +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java new file mode 100644 index 0000000000..cf55b36fc2 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +/** + */ +public class ReverseEncryptionStrategy implements EncryptionStrategy { + + public Object encryptMessage(Object msg) { + if ( msg instanceof String ) { + StringBuffer sb = new StringBuffer((String)msg); + msg = sb.reverse().toString(); + } + return msg; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java new file mode 100644 index 0000000000..ac610cfb51 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.policy.Policy; + +/** + + */ +public class WSPolicy implements Policy { + private boolean unresolved = true; + + public QName getSchemaName() { + return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment"); + } + + public boolean isUnresolved() { + return unresolved; + } + + public void setUnresolved(boolean unresolved) { + this.unresolved = unresolved; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java new file mode 100644 index 0000000000..fcb250b444 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.provider.policy; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; + +public class WSPolicyProcessor implements StAXArtifactProcessor { + + public QName getArtifactType() { + return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment"); + } + + public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + //FIXME Implement this method + return new WSPolicy(); + } + + public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { + //FIXME Implement this method + } + + public Class getModelType() { + return WSPolicy.class; + } + + public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException { + + } +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java new file mode 100644 index 0000000000..8ea2395d04 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo.server; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; + +/** + * A sample Echo server, showing how to integrate service bindings. + */ +public class EchoServer { + + public static EchoServer server; + + private Map services = new HashMap(); + + public static void start() { + } + + public static void stop() { + } + + public static EchoServer getServer() { + if (server == null) + server = new EchoServer(); + return server; + } + + /** + * Register a service under the given name. + * + * @param service + * @param name + */ + public void register(String uri, EchoServiceListener service) { + if (services.isEmpty()) { + start(); + } + services.put(uri, service); + } + + public void unregister(String uri) { + services.remove(uri); + if (services.isEmpty()) { + stop(); + } + } + + /** + * Dispatch an incoming interaction to the corresponding service. + * + * @param uri + * @param input + * @return + */ + public String sendReceive(String uri, String input) throws InvocationTargetException { + return services.get(uri).sendReceive(input); + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java new file mode 100644 index 0000000000..32336dd94f --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo.server; + +import java.lang.reflect.InvocationTargetException; + +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.invocation.MessageFactory; + +public class EchoServiceListener { + private Invoker invoker; + private MessageFactory messageFactory; + + public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) { + super(); + this.invoker = invoker; + this.messageFactory = messageFactory; + } + + public String sendReceive(String input) throws InvocationTargetException { + + // Create a request message + Message request = messageFactory.createMessage(); + request.setBody(new Object[] {input}); + + // Dispatch and get the response + Message response = invoker.invoke(request); + Object body = response.getBody(); + if (response.isFault()) { + throw new InvocationTargetException((Throwable)body); + } + return (String)body; + } + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory new file mode 100644 index 0000000000..55be293862 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the binding model factory +echo.impl.EchoBindingFactoryImpl diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..06d53250c1 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory +echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema new file mode 100644 index 0000000000..4ad61f573d --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# URI of the XML schema to be used for validation +sample-binding-echo.xsd diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory new file mode 100644 index 0000000000..efa475ef92 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the binding provider extension +echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding diff --git a/java/sca/contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd new file mode 100644 index 0000000000..9b64df4871 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/Echo.java b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/Echo.java new file mode 100644 index 0000000000..1d5e973f33 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/Echo.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +/** + * Interface of our sample Echo service. + * + * @version $Rev$ $Date$ + */ +public interface Echo { + + String echo(String msg); +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java new file mode 100644 index 0000000000..01b89101a8 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Reference; + + +/** + * A simple client component that uses a reference with an Echo binding. + * + * @version $Rev$ $Date$ + */ +public class EchoComponentImpl implements Echo { + + private Echo echoReference; + + @Constructor + public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) { + this.echoReference = echoReference; + } + + public String echo(String msg) { + String result = echoReference.echo(msg); + System.out.println("Returned message: "+ result); + return result; + } +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java new file mode 100644 index 0000000000..7383077f18 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * @version $Rev$ $Date$ + */ +public class EchoReferenceTestCase extends TestCase { + + private SCADomain scaDomain; + private Echo service; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("EchoBinding.composite"); + service = scaDomain.getService(Echo.class, "EchoComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testEchoBinding() { + String result = service.echo("foo"); + assertEquals(result, "oof"); + } + + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java new file mode 100644 index 0000000000..ab05516622 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import echo.server.EchoServer; + +/** + * @version $Rev$ $Date$ + */ +public class EchoServiceTestCase extends TestCase { + + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("EchoBinding.composite"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testEchoBinding() throws Exception { + String result = EchoServer.getServer().sendReceive("http://tempuri.org", "foo"); + assertEquals(result, "oof"); + } + + +} diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/java/sca/contrib/samples/binding-echo-extension/src/test/resources/EchoBinding.composite new file mode 100644 index 0000000000..176d67cc4b --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/resources/EchoBinding.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-echo-extension/src/test/resources/definitions.xml b/java/sca/contrib/samples/binding-echo-extension/src/test/resources/definitions.xml new file mode 100644 index 0000000000..1cb1d1c9ba --- /dev/null +++ b/java/sca/contrib/samples/binding-echo-extension/src/test/resources/definitions.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + Communitcation thro this binding must prevent + unauthorized users from reading the messages. + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/binding-echo/README b/java/sca/contrib/samples/binding-echo/README new file mode 100644 index 0000000000..2772460cc6 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/README @@ -0,0 +1,104 @@ +Binding Echo Sample Application +=============================== +This sample demonstrates how to use the new binding extension +binding-echo-extension. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens, open a command prompt, +navigate to this sample directory, and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-binding-echo.jar echo.EchoBindingClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-binding-echo.jar echo.EchoBindingClient + +This looks like a long command. The three things we add to the classpath are + +tuscany-sca-manifest.jar - all of the standard Tuscany SCA runtime and + extension classes +sample-binding-echo-extension.jar - the new echo binding extension implementation +sample-binding-echo - the application that uses the echo binding + +Note: this sample currently is not working on Linux + +Sample Overview +--------------- +This sample contains an application (client and server code) that uses +an SCA binding that simply echoes back any messages that are sent to it. + +binding-echo/ + src/ + main/ + java/ + echo/ + Echo.java - interface definition for the sample + reference and service + EchoComponentImpl.java - sample component implementation with + echo binding reference + EchoBindingClient.java - sample client + resources/ + EchoBinding.composite - the SCA assembly for this sample + test/ + java/ + echo + EchoBindingTestCase.java - sample JUnit test case for the sample + client + binding-echo.png - pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows. + +cd binding-echo +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Passing thro invoker... + [java] Returned message: foo + [java] Echo reference = foo + [java] Passing thro invoker... + [java] Returned message: bar + [java] Echo service = bar + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and +run using Maven as follows. + +cd binding-echo +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running echo.EchoBindingTestCase +Passing thro invoker... +Returned message: foo +Passing thro invoker... +Returned message: bar +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.811 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/binding-echo/binding-echo.png b/java/sca/contrib/samples/binding-echo/binding-echo.png new file mode 100644 index 0000000000..a38d985363 Binary files /dev/null and b/java/sca/contrib/samples/binding-echo/binding-echo.png differ diff --git a/java/sca/contrib/samples/binding-echo/binding-echo.svg b/java/sca/contrib/samples/binding-echo/binding-echo.svg new file mode 100644 index 0000000000..5b5051bef5 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/binding-echo.svg @@ -0,0 +1,174 @@ + + + + + + + + + + image/svg+xml + + + + + + + + EchoBinding + + + EchoComponent + + + + EchoSerivce EchoReference + + + diff --git a/java/sca/contrib/samples/binding-echo/build.xml b/java/sca/contrib/samples/binding-echo/build.xml new file mode 100644 index 0000000000..7689ef3a54 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-echo/pom.xml b/java/sca/contrib/samples/binding-echo/pom.xml new file mode 100644 index 0000000000..f5e2464563 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-binding-echo + Apache Tuscany SCA Echo Binding Sample Application + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + sample-binding-echo-extension + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/binding-echo/src/main/java/echo/Echo.java b/java/sca/contrib/samples/binding-echo/src/main/java/echo/Echo.java new file mode 100644 index 0000000000..1d5e973f33 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/src/main/java/echo/Echo.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +/** + * Interface of our sample Echo service. + * + * @version $Rev$ $Date$ + */ +public interface Echo { + + String echo(String msg); +} diff --git a/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoBindingClient.java b/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoBindingClient.java new file mode 100644 index 0000000000..21bdff4011 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoBindingClient.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import echo.server.EchoServer; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + * @version $Rev$ $Date$ + */ +public class EchoBindingClient { + + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("EchoBinding.composite"); + + // Call the echo service component which will, in turn, call a reference + // with an echo binding. The echo binding will echo the given string. + Echo service = scaDomain.getService(Echo.class, "EchoComponent"); + String echoString = service.echo("foo"); + System.out.println("Echo reference = " + echoString ); + + // Call the echo server. This will dispatch the call to a service with an + // echo binding. The echo binding will pass the call to the echo component. + echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar"); + System.out.println("Echo service = " + echoString ); + + scaDomain.close(); + + } + +} diff --git a/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java b/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java new file mode 100644 index 0000000000..01b89101a8 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package echo; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Reference; + + +/** + * A simple client component that uses a reference with an Echo binding. + * + * @version $Rev$ $Date$ + */ +public class EchoComponentImpl implements Echo { + + private Echo echoReference; + + @Constructor + public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) { + this.echoReference = echoReference; + } + + public String echo(String msg) { + String result = echoReference.echo(msg); + System.out.println("Returned message: "+ result); + return result; + } +} diff --git a/java/sca/contrib/samples/binding-echo/src/main/resources/EchoBinding.composite b/java/sca/contrib/samples/binding-echo/src/main/resources/EchoBinding.composite new file mode 100644 index 0000000000..94612fb325 --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/src/main/resources/EchoBinding.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java b/java/sca/contrib/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java new file mode 100644 index 0000000000..1a597fc80f --- /dev/null +++ b/java/sca/contrib/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package echo; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import echo.Echo; +import echo.server.EchoServer; + +public class EchoBindingTestCase extends TestCase { + + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("EchoBinding.composite"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testReference() throws Exception { + // Call the echo service component which will, in turn, call a reference + // with an echo binding. The echo binding will echo the given string. + Echo service = scaDomain.getService(Echo.class, "EchoComponent"); + String echoString = service.echo("foo"); + assertEquals(echoString, "foo"); + } + + public void testService() throws Exception { + // Call the echo server. This will dispatch the call to a service with an + // echo binding. The echo binding will pass the call to the echo component. + String echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar"); + assertEquals(echoString, "bar"); + } +} diff --git a/java/sca/contrib/samples/binding-notification-broker/README b/java/sca/contrib/samples/binding-notification-broker/README new file mode 100644 index 0000000000..ebd8bbec30 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/README @@ -0,0 +1,112 @@ +Notification Broker Binding Sample +================================== + +This sample illustrates the use of with a +broker. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +Sample Overview +--------------- + +This sample illustrates the use of a notification broker that is located in a +separate (and remote) composite with respect to any producers or consumers. As +such, this sample is run in conjunction with the binding-notification-producer +sample, the binding-notification-consumer sample, or both. Take a look at the +composite file or the .svg file which shows the composite file in pictorial form. +The composite service and composite reference each have a +that handles the remote communication. This binding includes an 'ntm' attribute +that refers to the notification type manager, which manages the connectivity of +producers, consumers and brokers, and which (for this sample) is assumed to be +running on http://localhost:8083. The ntm is a system component that is included in +and runs as part of the binding-notification module. +This sample also illustrates the use of a wsdl interface in the notification +component's . This allows messages sent and received +via to be transported as literal xml over http. + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd binding-notification-broker +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory + [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory + [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory + +Building And Running The Sample Using Maven +------------------------------------------- + +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd binding-notification-broker +mvn + +Sample Usage +------------ + +This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and + +on Wondows, use following command: + +java -Dnotification.httpPort=8080 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-broker.jar notification.broker.TrafficAdvisoryServer + +on *nix, use following command: + +java -Dnotification.httpPort=8080 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-broker.jar notification.broker.TrafficAdvisoryServer + +this should bring up the following prompt: + +Send a report value, ^C or to end + +at this point you should be able to type a message to send, for instance: + +Traffic congestion + +Notice that before you try to receive any message, you should bring up the +consumer sample or another broker sample. When you have finished using this +sample, type 'end' or ^C to end. + +Also notice that '-Dnotification.httpPort=8080' is used in the java command. +This indicates the port the sample should use. This also says that this server +is not going to play the role of ntm, given our previous assumption. It is important +that the first one of the producer, consumer or broker sample that is run be the +one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk +to and an exception will be thrown. + +Sample directory structure: +--------------------------- + +binding-notification-broker/ + src/ + main/ + java/ + notification.broker/ + TestCaseProducer.java - interface for the producer component + TrafficAdvisory.java - remote interface referred to by the producer component + and for the consumer component + TrafficAdvisoryConsumer.java - implementation for the consumer components + TrafficAdvisoryProducer.java - implementation for the producer component + TrafficAdvisoryServer.java - server class including main entry point + resources/ + wsdl/ + TrafficAdvisory.wsdl - remote interface for the notification component + TrafficAdvisoryNotification.componentType - the component type referred to by + + TrafficAdvisoryNotification.composite - the main composite including producer, consumer and + notification components, and composite service and reference + binding-notification-broker.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file diff --git a/java/sca/contrib/samples/binding-notification-broker/binding-notification-broker.png b/java/sca/contrib/samples/binding-notification-broker/binding-notification-broker.png new file mode 100644 index 0000000000..49030650f2 Binary files /dev/null and b/java/sca/contrib/samples/binding-notification-broker/binding-notification-broker.png differ diff --git a/java/sca/contrib/samples/binding-notification-broker/build.xml b/java/sca/contrib/samples/binding-notification-broker/build.xml new file mode 100644 index 0000000000..a042b9036a --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-broker/pom.xml b/java/sca/contrib/samples/binding-notification-broker/pom.xml new file mode 100644 index 0000000000..82e79c24f5 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/pom.xml @@ -0,0 +1,98 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-binding-notification-broker + Apache Tuscany SCA Notification Binding Broker Sample + 2.0-SNAPSHOT + A sample illustrating use of binding.notification + + + + org.apache.tuscany.sca + tuscany-implementation-notification + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-binding-notification + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-databinding + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-interface-wsdl + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + install + + diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java new file mode 100644 index 0000000000..35fa1a9ee9 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.broker; + +public interface TestCaseProducer { + + public void produceTrafficNotification(String report); +} diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java new file mode 100644 index 0000000000..3f069ede78 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.broker; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface TrafficAdvisory { + + void trafficNotification(String report); +} diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java new file mode 100644 index 0000000000..b9a5b98126 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.broker; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(TrafficAdvisory.class) +@Scope("COMPOSITE") +@AllowsPassByReference +public class TrafficAdvisoryConsumer implements TrafficAdvisory { + + @Property + protected String name; + + public void trafficNotification(String report) { + + System.out.println("Consumer [" + name + "] received report: " + report); + } +} diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java new file mode 100644 index 0000000000..6406572d10 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.broker; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +@Service(TestCaseProducer.class) +@Scope("COMPOSITE") +public class TrafficAdvisoryProducer implements TestCaseProducer { + + @Reference + protected TrafficAdvisory destination; + + public void produceTrafficNotification(String report) { + + destination.trafficNotification(report); + } +} diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java new file mode 100644 index 0000000000..b0f0d2a800 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.broker; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URI; + +import org.apache.tuscany.sca.binding.notification.NotificationBindingProviderFactory; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * @version $Rev$ $Date$ + */ +public class TrafficAdvisoryServer { + + private static URI notificationType; + + public static void main(String[] args) { + try { + notificationType = new URI("trafficAdvisory"); + String compositeName = "TrafficAdvisoryNotification.composite"; + SCADomain domain = SCADomain.newInstance(compositeName); + TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); + + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + String value = ""; + if (args.length == 1) { + value = args[0]; + } + do { + if(value == null || value.equals("end")) { + break; + } + try { + System.out.println("Send a report value, ^C or to end"); + value = reader.readLine(); + } catch (IOException e) { + e.printStackTrace(); + } + if (value.equals("rb")) { + NotificationBindingProviderFactory.removeBroker(notificationType); + } + else { + testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); + } + } + while(true); + + domain.close(); + } catch(Throwable e) { + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType new file mode 100644 index 0000000000..2dc70f8ed1 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite new file mode 100644 index 0000000000..f490c34ea6 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Consumer1 + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl new file mode 100644 index 0000000000..b823bbebcc --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/README b/java/sca/contrib/samples/binding-notification-consumer/README new file mode 100644 index 0000000000..b54b445670 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/README @@ -0,0 +1,109 @@ +Notification Consumer Binding Sample +=============================== + +This sample illustrates the use of with a +remote consumer. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +Sample Overview +--------------- + +This sample illustrates the use of a notification consumer that is located in a +separate (and remote) composite with respect to any producers. As such, this sample +is run in conjunction with the binding-notification-producer sample, the +binding-notification-broker sample, or both. Take a look at the composite file +or the .svg file which shows the composite file in pictorial form. The composite +service, wired to the notification component, has a +that handles the remote communication. This binding includes an 'ntm' attribute +that refers to the notification type manager, which manages the connectivity of +producers, consumers and brokers, and which (for this sample) is assumed to be +running on http://localhost:8083. The ntm is a system component that is included in +and runs as part of the binding-notification module. +This sample also illustrates the use of a wsdl interface in the notification +component's . This allows messages sent and received +via to be transported as literal xml over http. + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd binding-notification-consumer +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory + [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd binding-notification-consumer +mvn + +Sample Usage +------------ + +This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and + +on Wondows, use following command: + +java -Dnotification.httpPort=8082 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-consumer.jar notification.consumer.TrafficAdvisoryServer + +on *nix, use following command: + +java -Dnotification.httpPort=8082 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-consumer.jar notification.consumer.TrafficAdvisoryServer + +this should bring up the following prompt: + +TrafficAdvisoryServer, hit return to end + +at this point you should be able to receive messages. + +Notice that before you try to receive any message, you should bring up the +producer sample or the broker sample. When you have finished using this +sample, hit return to end. + +Also notice that '-Dnotification.httpPort=8082' is used in the java command. +This indicates the port the sample should use. This also says that this server +is not going to play the role of ntm, given our previous assumption. It is important +that the first one of the producer, consumer or broker sample that is run be the +one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk +to and an exception will be thrown. + +Sample directory structure: +--------------------------- + +binding-notification-consumer/ + src/ + main/ + java/ + notification.consumer/ + TrafficAdvisory.java - remote interface referred to by the producer component + TrafficAdvisoryConsumer.java - implementation for the consumer components + TrafficAdvisoryServer.java - server class including main entry point + resources/ + wsdl/ + TrafficAdvisory.wsdl - remote interface for the notification component + TrafficAdvisoryNotification.componentType - the component type referred to by + + TrafficAdvisoryNotification.composite - the main composite including producer and + notification components, and composite reference + test/ + java/ + notification.producer/ + TrafficAdvisoryTestCase.java - JUnit test case + resources/ + binding-notification-consumer.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file diff --git a/java/sca/contrib/samples/binding-notification-consumer/binding-notification-consumer.png b/java/sca/contrib/samples/binding-notification-consumer/binding-notification-consumer.png new file mode 100644 index 0000000000..33e1966c3e Binary files /dev/null and b/java/sca/contrib/samples/binding-notification-consumer/binding-notification-consumer.png differ diff --git a/java/sca/contrib/samples/binding-notification-consumer/build.xml b/java/sca/contrib/samples/binding-notification-consumer/build.xml new file mode 100644 index 0000000000..f57fe1bb26 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/pom.xml b/java/sca/contrib/samples/binding-notification-consumer/pom.xml new file mode 100644 index 0000000000..c1452f7d02 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/pom.xml @@ -0,0 +1,116 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-binding-notification-consumer + Apache Tuscany SCA Notification Binding Consumer Sample + 2.0-SNAPSHOT + A sample illustrating use of binding.notification + + + + org.apache.tuscany.sca + tuscany-implementation-notification + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-notification + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-interface-java-xml + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + notification.httpPort + 8083 + + + + + + install + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java new file mode 100644 index 0000000000..424728692f --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.consumer; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface TrafficAdvisory { + + void trafficNotification(String report); +} diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java new file mode 100644 index 0000000000..852ddaa919 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.consumer; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(TrafficAdvisory.class) +@Scope("COMPOSITE") +@AllowsPassByReference +public class TrafficAdvisoryConsumer implements TrafficAdvisory { + + @Property + protected String name; + + public void trafficNotification(String report) { + + System.out.println("Consumer [" + name + "] received report: " + report); + } +} diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java new file mode 100644 index 0000000000..c53adb1944 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.consumer; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * @version $Rev$ $Date$ + */ +public class TrafficAdvisoryServer { + + public static void main(String[] args) { + try { + SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + + try { + if (args.length != 1 || !args[0].equals("end")) { + System.out.println("TrafficAdvisoryServer, hit return to end"); + System.in.read(); + } + } catch (IOException e) { + e.printStackTrace(); + } + + domain.close(); + } catch(Throwable e) { + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType new file mode 100644 index 0000000000..2dc70f8ed1 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite new file mode 100644 index 0000000000..8f9bcc4438 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + Consumer1 + + + + + Consumer2 + + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl new file mode 100644 index 0000000000..b823bbebcc --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java b/java/sca/contrib/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java new file mode 100644 index 0000000000..c5318f405c --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.consumer; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import junit.framework.TestCase; + +public class TrafficAdvisoryTestCase extends TestCase { + + private SCADomain domain; + + public void testTrafficAdvisoryNotification() throws Exception { + System.out.println("Only instantiating and closing domain ..."); + + /* Uncomment to test with producer + try { + System.out.println("TrafficAdvisoryServer, hit return to end"); + System.in.read(); + } catch (Exception e) { + e.printStackTrace(); + } + */ + } + + @Override + protected void setUp() throws Exception { + try { + domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + else { + throw new Exception(e); + } + } + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/java/sca/contrib/samples/binding-notification-producer/README b/java/sca/contrib/samples/binding-notification-producer/README new file mode 100644 index 0000000000..c5f284d4c5 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/README @@ -0,0 +1,133 @@ +Notification Producer Binding Sample +=============================== + +This sample illustrates the use of with a +remote producer. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +Sample Overview +--------------- + +This sample illustrates the use of a notification producer that is located in a +separate (and remote) composite with respect to any consumers. As such, this sample +is run in conjunction with the binding-notification-consumer sample, the +binding-notification-broker sample, or both. Take a look at the composite file +or the .svg file which shows the composite file in pictorial form. The composite +reference, referred to by the notification component, has a +that handles the remote communication. This binding includes an 'ntm' attribute +that refers to the notification type manager, which manages the connectivity of +producers, consumers and brokers, and which (for this sample) is assumed to be +running on http://localhost:8083. The ntm is a system component that is included in +and runs as part of the binding-notification module. +This sample also illustrates the use of a wsdl interface in the notification +component's . This allows messages sent and received +via to be transported as literal xml over http. + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd binding-notification-producer +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory + [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd binding-notification-producer +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running notification.producer.TrafficAdvisoryTestCase +Only instantiating and closing domain ... +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.252 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. + +Sample Usage +------------ + +This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and + +on Wondows, use following command: + +java -Dnotification.httpPort=8083 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-producer.jar notification.producer.TrafficAdvisoryServer + +on *nix, use following command: + +java -Dnotification.httpPort=8083 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-producer.jar notification.producer.TrafficAdvisoryServer + +this should bring up the following prompt: + +Send a report value, ^C or to end + +at this point you should be able to type a message to send, for instance: + +Traffic congestion + +Notice that before you try to send any message, you should bring up the +consumer sample or the broker sample. When you have finished using this +sample, type 'end' or ^C to end. + +Also notice that '-Dnotification.httpPort=8083' is used in the java command. +This indicates the port the sample should use. This also says that this server +is going to play the role of ntm, given our previous assumption. It is important +that the first one of the producer, consumer or broker sample that is run be the +one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk +to and an exception will be thrown. + +Sample directory structure: +--------------------------- + +binding-notification-producer/ + src/ + main/ + java/ + notification.producer/ + TestCaseProducer.java - interface for the producer component + TrafficAdvisory.java - remote interface referred to by the producer component + TrafficAdvisoryProducer.java - implementation for the producer component + TrafficAdvisoryServer.java - server class including main entry point + resources/ + wsdl/ + TrafficAdvisory.wsdl - remote interface for the notification component + TrafficAdvisoryNotification.componentType - the component type referred to by + + TrafficAdvisoryNotification.composite - the main composite including producer and + notification components, and composite reference + test/ + java/ + notification.producer/ + TrafficAdvisoryTestCase.java - JUnit test case + resources/ + wsdl/ + TrafficAdvisory.wsdl - remote interface for the notification component + TrafficAdvisoryNotification.componentType - the component type referred to by + + TrafficAdvisoryNotification.composite - the main composite including producer and + notification components, and composite reference + binding-notification-producer.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file diff --git a/java/sca/contrib/samples/binding-notification-producer/binding-notification-producer.png b/java/sca/contrib/samples/binding-notification-producer/binding-notification-producer.png new file mode 100644 index 0000000000..34c347c893 Binary files /dev/null and b/java/sca/contrib/samples/binding-notification-producer/binding-notification-producer.png differ diff --git a/java/sca/contrib/samples/binding-notification-producer/build.xml b/java/sca/contrib/samples/binding-notification-producer/build.xml new file mode 100644 index 0000000000..d13e4c8a6c --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-producer/pom.xml b/java/sca/contrib/samples/binding-notification-producer/pom.xml new file mode 100644 index 0000000000..ffe90c0cb3 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/pom.xml @@ -0,0 +1,127 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-binding-notification-producer + Apache Tuscany SCA Notification Binding Producer Sample + 2.0-SNAPSHOT + A sample illustrating use of binding.notification + + + + org.apache.tuscany.sca + tuscany-implementation-notification + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-notification + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 2.0-SNAPSHOT + runtime + + + + javax.servlet + servlet-api + 2.5 + provided + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.apache.tuscany.notification.remoteProducer.TrafficAdvisoryServer + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + notification.httpPort + 8083 + + + + + + install + + diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java new file mode 100644 index 0000000000..be80e71249 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.producer; + +public interface TestCaseProducer { + + public void produceTrafficNotification(String report); +} diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java new file mode 100644 index 0000000000..548d45b12d --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.producer; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface TrafficAdvisory { + + void trafficNotification(String report); +} diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java new file mode 100644 index 0000000000..e670ccb95c --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.producer; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +@Service(TestCaseProducer.class) +@Scope("COMPOSITE") +public class TrafficAdvisoryProducer implements TestCaseProducer { + + @Reference + protected TrafficAdvisory destination; + + public void produceTrafficNotification(String report) { + + destination.trafficNotification(report); + } +} diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java new file mode 100644 index 0000000000..efd3657dc3 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.producer; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class TrafficAdvisoryServer { + + public static void main(String[] args) { + try { + SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + String value = ""; + if (args.length == 1) { + value = args[0]; + } + do { + if(value == null || value.equals("end")) { + break; + } + try { + System.out.println("Send a report value, ^C or to end"); + value = reader.readLine(); + } catch (IOException e) { + e.printStackTrace(); + } + testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); + } + while(true); + + domain.close(); + } catch(Throwable e) { + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType new file mode 100644 index 0000000000..2dc70f8ed1 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite new file mode 100644 index 0000000000..2db6ea655b --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl new file mode 100644 index 0000000000..b823bbebcc --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java b/java/sca/contrib/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java new file mode 100644 index 0000000000..d3901ee407 --- /dev/null +++ b/java/sca/contrib/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification.producer; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import notification.producer.TestCaseProducer; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +//import org.apache.tuscany.sca.notification.remoteProducer.TestCaseProducer; + +import junit.framework.TestCase; + +public class TrafficAdvisoryTestCase extends TestCase { + + private SCADomain domain; + + public void testTrafficAdvisoryNotification() throws Exception { + System.out.println("Only instantiating and closing domain ..."); + TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); + + /* Uncomment to test with consumer + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + String value = "foo"; + do { + try { + System.out.println("Send a report value, ^C or to end"); + value = reader.readLine(); + } catch (Exception e) { + e.printStackTrace(); + } + if(value == null || value.equals("end")) { + break; + } + testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); + value = "end"; + } + while(true); + */ + } + + @Override + protected void setUp() throws Exception { + try { + domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + else { + throw new Exception(e); + } + } + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/README b/java/sca/contrib/samples/calculator-corba-reference/README new file mode 100644 index 0000000000..66c4cddb94 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/README @@ -0,0 +1,83 @@ +Calculator CORBA Reference Sample +=============================== + +This sample illustrates the use of Tuscany CORBA Binding to call reference +services that are hosted as CORBA services. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + + +Sample Overview +--------------- +This sample extends the calculator sample by replacing the local wired +connections with CORBA bindings. Instead of local add, subtract, multiply and +divide components, an CORBA service implementation now provides the +add, subtract, multiply and divide interfaces and is hosted as an CORBA object. +References specified in the .composite file include a CORBA binding which targets +this CORBA object. Name service which is used in CORBA communication is provided +in test case class - CalculatorCORBAReferenceTestCase.java. + +This sample adds a number of classes to the basic calculator sample: + +calculator-corba-reference/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - as calculator sample + AddService.java - as calculator sample + SubtractService.java - as calculator sample + MultipleService.java - as calculator sample + DivideService.java - as calculator sample + CalculatorClient.java - as calculator sample + CalculatorServiceImpl.java - calls the CORBA service + that provides the target for the + CORBA bindings in the composite + resources/ + CalculatorCORBAReference.composite - the SCA assembly for this sample + test/ + java/ + calculator/ + CalculatorCORBAReferenceTestCase.java - JUnit test case + CalculatorCORBAServant.java - CORBA service implementation + idl/ - contains files generated + from IDL file. Files are + used to create CORBA object which + will be consumed by SCA reference. + _CalculatorCORBAServiceImplBase.java + CalculatorCORBAService.java + CalculatorCORBAServiceOperations.java + resources/ + CalculatorCORBA.idl - IDL description for CORBA object + pom.xml - the Maven build file + +Note. As this test creates and uses local network connections you may need to +configure your firewall, if you are running one, to allow the test to run +successfully. + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-corba-reference +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorCORBAReferenceTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.308 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. + + + diff --git a/java/sca/contrib/samples/calculator-corba-reference/pom.xml b/java/sca/contrib/samples/calculator-corba-reference/pom.xml new file mode 100644 index 0000000000..96d4ce402c --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-corba-reference + Apache Tuscany SCA Calculator CORBA Reference Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-binding-corba-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-host-corba-jse + 2.0-SNAPSHOT + runtime + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..ec57a6a533 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the add service + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..cd1076c3f1 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite"); + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..0bac3da45c --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.rmi.Remote; +import java.rmi.RemoteException; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The Calculator service interface. + */ +@Remotable +public interface CalculatorService extends Remote { + + double add(double n1, double n2) throws RemoteException; + + double subtract(double n1, double n2) throws RemoteException; + + double multiply(double n1, double n2) throws RemoteException; + + double divide(double n1, double n2) throws RemoteException; +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..675350860e --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..835e4fda6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..30e4e6a56a --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite b/java/sca/contrib/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite new file mode 100644 index 0000000000..717add91a8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java new file mode 100644 index 0000000000..041608273b --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.corba.naming.TransientNameServer; +import org.apache.tuscany.sca.host.corba.naming.TransientNameService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.omg.CORBA.ORB; +import org.omg.CosNaming.NameComponent; +import org.omg.CosNaming.NamingContext; +import org.omg.CosNaming.NamingContextHelper; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorCORBAReferenceTestCase extends TestCase { + + private SCADomain scaDomain; + private CalculatorService calculatorService; + private TransientNameServer server; + + private void bindObject(String name, org.omg.CORBA.Object object) throws Exception { + ORB orb = server.getORB(); + org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); + NamingContext ncRef = NamingContextHelper.narrow(objRef); + NameComponent nc = new NameComponent(name, ""); + NameComponent path[] = {nc}; + ncRef.rebind(path, object); + } + + @BeforeClass + protected void setUp() throws Exception { + // create name service + server = new TransientNameServer("localhost", 5080, TransientNameService.DEFAULT_SERVICE_NAME); + Thread t = server.start(); + if (t == null) { + Assert.fail("The naming server cannot be started"); + } else { + // create CORBA object which will be accessible by SCA CORBA binding + bindObject("CalculatorCORBAService", new CalculatorCORBAServant()); + scaDomain = SCADomain.newInstance("CalculatorCORBAReference.composite"); + calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + } + } + + @AfterClass + protected void tearDown() throws Exception { + scaDomain.close(); + server.stop(); + } + + @Test + public void testCalculator() throws Exception { + assertEquals(5.0, calculatorService.add(3, 2)); + assertEquals(1.0, calculatorService.subtract(3, 2)); + assertEquals(6.0, calculatorService.multiply(3, 2)); + assertEquals(1.5, calculatorService.divide(3, 2)); + } +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java new file mode 100644 index 0000000000..65e9b89ce2 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import calculator.idl._CalculatorCORBAServiceImplBase; + +public class CalculatorCORBAServant extends _CalculatorCORBAServiceImplBase { + + private static final long serialVersionUID = 1L; + + public double add(double arg1, double arg2) { + return arg1 + arg2; + } + + public double subtract(double arg1, double arg2) { + return arg1 - arg2; + } + + public double multiply(double arg1, double arg2) { + return arg1 * arg2; + } + + public double divide(double arg1, double arg2) { + return arg1 / arg2; + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java new file mode 100644 index 0000000000..6206e0cf6f --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/CalculatorCORBAService.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST +*/ + +public interface CalculatorCORBAService extends CalculatorCORBAServiceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity +{ +} // interface CalculatorCORBAService diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java new file mode 100644 index 0000000000..6facda6a34 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/CalculatorCORBAServiceOperations.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST +*/ + +public interface CalculatorCORBAServiceOperations +{ + double add (double arg1, double arg2); + double subtract (double arg1, double arg2); + double multiply (double arg1, double arg2); + double divide (double arg1, double arg2); +} // interface CalculatorCORBAServiceOperations diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java new file mode 100644 index 0000000000..f6a4bd8994 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/_CalculatorCORBAServiceImplBase.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST +*/ + +public abstract class _CalculatorCORBAServiceImplBase extends org.omg.CORBA.portable.ObjectImpl + implements calculator.idl.CalculatorCORBAService, org.omg.CORBA.portable.InvokeHandler +{ + + // Constructors + public _CalculatorCORBAServiceImplBase () + { + } + + private static java.util.Hashtable _methods = new java.util.Hashtable (); + static + { + _methods.put ("add", new java.lang.Integer (0)); + _methods.put ("subtract", new java.lang.Integer (1)); + _methods.put ("multiply", new java.lang.Integer (2)); + _methods.put ("divide", new java.lang.Integer (3)); + } + + public org.omg.CORBA.portable.OutputStream _invoke (String $method, + org.omg.CORBA.portable.InputStream in, + org.omg.CORBA.portable.ResponseHandler $rh) + { + org.omg.CORBA.portable.OutputStream out = null; + java.lang.Integer __method = (java.lang.Integer)_methods.get ($method); + if (__method == null) + throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + + switch (__method.intValue ()) + { + case 0: // calculator/idl/CalculatorCORBAService/add + { + double arg1 = in.read_double (); + double arg2 = in.read_double (); + double $result = (double)0; + $result = this.add (arg1, arg2); + out = $rh.createReply(); + out.write_double ($result); + break; + } + + case 1: // calculator/idl/CalculatorCORBAService/subtract + { + double arg1 = in.read_double (); + double arg2 = in.read_double (); + double $result = (double)0; + $result = this.subtract (arg1, arg2); + out = $rh.createReply(); + out.write_double ($result); + break; + } + + case 2: // calculator/idl/CalculatorCORBAService/multiply + { + double arg1 = in.read_double (); + double arg2 = in.read_double (); + double $result = (double)0; + $result = this.multiply (arg1, arg2); + out = $rh.createReply(); + out.write_double ($result); + break; + } + + case 3: // calculator/idl/CalculatorCORBAService/divide + { + double arg1 = in.read_double (); + double arg2 = in.read_double (); + double $result = (double)0; + $result = this.divide (arg1, arg2); + out = $rh.createReply(); + out.write_double ($result); + break; + } + + default: + throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); + } + + return out; + } // _invoke + + // Type-specific CORBA::Object operations + private static String[] __ids = { + "IDL:calculator/idl/CalculatorCORBAService:1.0"}; + + public String[] _ids () + { + return (String[])__ids.clone (); + } + + +} // class _CalculatorCORBAServiceImplBase diff --git a/java/sca/contrib/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl b/java/sca/contrib/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl new file mode 100644 index 0000000000..55ffeac8a3 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Compile by: idlj -fserver -oldImplBase CalculatorCORBA.idl + */ + +module calculator { + module idl { + interface CalculatorCORBAService { + double add(in double arg1, in double arg2); + double subtract(in double arg1, in double arg2); + double multiply(in double arg1, in double arg2); + double divide(in double arg1, in double arg2); + }; + }; +}; \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-corba-service/README b/java/sca/contrib/samples/calculator-corba-service/README new file mode 100644 index 0000000000..87863752cd --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/README @@ -0,0 +1,82 @@ +Calculator CORBA Service Sample +============================= + +This sample illustrates the use of Tuscany CORBA Binding to expose component +services as CORBA objects. It also demonstrates how a simple Java CORBA +Client application invokes the SCA Application's services exposed as CORBA +Services. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + + +Sample Overview +--------------- +This sample extends the calculator sample by replacing the local service +binding with an CORBA binding. So a java client can call the service exposed +by the SCA application using an CORBA client. Name service which is used in +CORBA communication is provided by Tuscany CORBA hosting module +(maven dependency: tuscany-host-corba-jse-tns) - see CORBA binding reference +on Apache Tuscany website for details. + +This sample adds a number of classes to the basic calculator sample: + +calculator-corba-service/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - as calculator sample + CalculatorServiceImpl.java + AddService.java - as calculator sample + AddServiceImpl.java + SubtractService.java - as calculator sample + SubtractServiceImpl.java + MultiplyService.java - as calculator sample + MultiplyServiceImpl.java + DivideService.java - as calculator sample + DivideServiceImpl.java + resources/ + CalculatorCORBAServer.composite - the SCA assembly for this sample + test/ + java/ + calculator/ + CalculatorCORBAServerTestCase.java - JUnit test case + idl/ - contains files generated + from IDL file. Files are + used to access SCA component. + CalculatorCORBAServiceHelper.java + CalculatorCORBAService.java + _CalculatorCORBAServiceStub.java + CalculatorCORBAServiceHolder.java + CalculatorCORBAServiceOperations.java + resources/ + CalculatorCORBA.idl - IDL description for SCA component + pom.xml - the Maven build file + +Note. As this test creates and uses local network connections you may need to +configure your firewall, if you are running one, to allow the test to run +successfully. + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-corba-service +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorCORBAServerTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.819 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/calculator-corba-service/pom.xml b/java/sca/contrib/samples/calculator-corba-service/pom.xml new file mode 100644 index 0000000000..63c5f5f9a6 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/pom.xml @@ -0,0 +1,74 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-corba-service + Apache Tuscany SCA Calculator CORBA Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-binding-corba-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-host-corba-jse-tns + 2.0-SNAPSHOT + runtime + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..ec57a6a533 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the add service + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e9c635e3c8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..b0a46b6dd0 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The Calculator service interface. + */ +@Remotable +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..675350860e --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..835e4fda6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..30e4e6a56a --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1a7f145ad8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite b/java/sca/contrib/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite new file mode 100644 index 0000000000..1ab6cecef7 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java new file mode 100644 index 0000000000..4248ca8573 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.omg.CORBA.ORB; + +import calculator.idl.CalculatorCORBAService; +import calculator.idl.CalculatorCORBAServiceHelper; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorCORBAServerTestCase extends TestCase { + + private SCADomain scaDomain; + private CalculatorCORBAService calculatorService; + + @BeforeClass + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("CalculatorCORBAServer.composite"); + String[] args = {"-ORBInitialPort", "5080"}; + // retrieve CORBA object which is SCA component + ORB orb = ORB.init(args, null); + calculatorService = + CalculatorCORBAServiceHelper.narrow(orb + .string_to_object("corbaname::localhost:5080#CalculatorCORBAService")); + } + + @AfterClass + protected void tearDown() throws Exception { + scaDomain.close(); + } + + @Test + public void testCalculator() throws Exception { + assertEquals(5.0, calculatorService.add(3, 2)); + assertEquals(1.0, calculatorService.subtract(3, 2)); + assertEquals(6.0, calculatorService.multiply(3, 2)); + assertEquals(1.5, calculatorService.divide(3, 2)); + } +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java new file mode 100644 index 0000000000..6576358755 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/CalculatorCORBAService.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST +*/ + +public interface CalculatorCORBAService extends CalculatorCORBAServiceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity +{ +} // interface CalculatorCORBAService diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java new file mode 100644 index 0000000000..0977982fb3 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java @@ -0,0 +1,104 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/CalculatorCORBAServiceHelper.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST +*/ + +abstract public class CalculatorCORBAServiceHelper +{ + private static String _id = "IDL:calculator/idl/CalculatorCORBAService:1.0"; + + public static void insert (org.omg.CORBA.Any a, calculator.idl.CalculatorCORBAService that) + { + org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); + a.type (type ()); + write (out, that); + a.read_value (out.create_input_stream (), type ()); + } + + public static calculator.idl.CalculatorCORBAService extract (org.omg.CORBA.Any a) + { + return read (a.create_input_stream ()); + } + + private static org.omg.CORBA.TypeCode __typeCode = null; + synchronized public static org.omg.CORBA.TypeCode type () + { + if (__typeCode == null) + { + __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (calculator.idl.CalculatorCORBAServiceHelper.id (), "CalculatorCORBAService"); + } + return __typeCode; + } + + public static String id () + { + return _id; + } + + public static calculator.idl.CalculatorCORBAService read (org.omg.CORBA.portable.InputStream istream) + { + return narrow (istream.read_Object (_CalculatorCORBAServiceStub.class)); + } + + public static void write (org.omg.CORBA.portable.OutputStream ostream, calculator.idl.CalculatorCORBAService value) + { + ostream.write_Object ((org.omg.CORBA.Object) value); + } + + public static calculator.idl.CalculatorCORBAService narrow (org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof calculator.idl.CalculatorCORBAService) + return (calculator.idl.CalculatorCORBAService)obj; + else if (!obj._is_a (id ())) + throw new org.omg.CORBA.BAD_PARAM (); + else + { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); + calculator.idl._CalculatorCORBAServiceStub stub = new calculator.idl._CalculatorCORBAServiceStub (); + stub._set_delegate(delegate); + return stub; + } + } + + public static calculator.idl.CalculatorCORBAService unchecked_narrow (org.omg.CORBA.Object obj) + { + if (obj == null) + return null; + else if (obj instanceof calculator.idl.CalculatorCORBAService) + return (calculator.idl.CalculatorCORBAService)obj; + else + { + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); + calculator.idl._CalculatorCORBAServiceStub stub = new calculator.idl._CalculatorCORBAServiceStub (); + stub._set_delegate(delegate); + return stub; + } + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java new file mode 100644 index 0000000000..0cf6439d49 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + +/** +* calculator/idl/CalculatorCORBAServiceHolder.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST +*/ + +public final class CalculatorCORBAServiceHolder implements org.omg.CORBA.portable.Streamable +{ + public calculator.idl.CalculatorCORBAService value = null; + + public CalculatorCORBAServiceHolder () + { + } + + public CalculatorCORBAServiceHolder (calculator.idl.CalculatorCORBAService initialValue) + { + value = initialValue; + } + + public void _read (org.omg.CORBA.portable.InputStream i) + { + value = calculator.idl.CalculatorCORBAServiceHelper.read (i); + } + + public void _write (org.omg.CORBA.portable.OutputStream o) + { + calculator.idl.CalculatorCORBAServiceHelper.write (o, value); + } + + public org.omg.CORBA.TypeCode _type () + { + return calculator.idl.CalculatorCORBAServiceHelper.type (); + } + +} diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java new file mode 100644 index 0000000000..3e2956d469 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/CalculatorCORBAServiceOperations.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST +*/ + +public interface CalculatorCORBAServiceOperations +{ + double add (double arg1, double arg2); + double subtract (double arg1, double arg2); + double multiply (double arg1, double arg2); + double divide (double arg1, double arg2); +} // interface CalculatorCORBAServiceOperations diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java new file mode 100644 index 0000000000..ad193ee121 --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java @@ -0,0 +1,143 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.idl; + + +/** +* calculator/idl/_CalculatorCORBAServiceStub.java . +* Generated by the IDL-to-Java compiler (portable), version "3.2" +* from CalculatorCORBA.idl +* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST +*/ + +public class _CalculatorCORBAServiceStub extends org.omg.CORBA.portable.ObjectImpl implements calculator.idl.CalculatorCORBAService +{ + + public double add (double arg1, double arg2) + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("add", true); + $out.write_double (arg1); + $out.write_double (arg2); + $in = _invoke ($out); + double $result = $in.read_double (); + return $result; + } catch (org.omg.CORBA.portable.ApplicationException $ex) { + $in = $ex.getInputStream (); + String _id = $ex.getId (); + throw new org.omg.CORBA.MARSHAL (_id); + } catch (org.omg.CORBA.portable.RemarshalException $rm) { + return add (arg1, arg2 ); + } finally { + _releaseReply ($in); + } + } // add + + public double subtract (double arg1, double arg2) + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("subtract", true); + $out.write_double (arg1); + $out.write_double (arg2); + $in = _invoke ($out); + double $result = $in.read_double (); + return $result; + } catch (org.omg.CORBA.portable.ApplicationException $ex) { + $in = $ex.getInputStream (); + String _id = $ex.getId (); + throw new org.omg.CORBA.MARSHAL (_id); + } catch (org.omg.CORBA.portable.RemarshalException $rm) { + return subtract (arg1, arg2 ); + } finally { + _releaseReply ($in); + } + } // subtract + + public double multiply (double arg1, double arg2) + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("multiply", true); + $out.write_double (arg1); + $out.write_double (arg2); + $in = _invoke ($out); + double $result = $in.read_double (); + return $result; + } catch (org.omg.CORBA.portable.ApplicationException $ex) { + $in = $ex.getInputStream (); + String _id = $ex.getId (); + throw new org.omg.CORBA.MARSHAL (_id); + } catch (org.omg.CORBA.portable.RemarshalException $rm) { + return multiply (arg1, arg2 ); + } finally { + _releaseReply ($in); + } + } // multiply + + public double divide (double arg1, double arg2) + { + org.omg.CORBA.portable.InputStream $in = null; + try { + org.omg.CORBA.portable.OutputStream $out = _request ("divide", true); + $out.write_double (arg1); + $out.write_double (arg2); + $in = _invoke ($out); + double $result = $in.read_double (); + return $result; + } catch (org.omg.CORBA.portable.ApplicationException $ex) { + $in = $ex.getInputStream (); + String _id = $ex.getId (); + throw new org.omg.CORBA.MARSHAL (_id); + } catch (org.omg.CORBA.portable.RemarshalException $rm) { + return divide (arg1, arg2 ); + } finally { + _releaseReply ($in); + } + } // divide + + // Type-specific CORBA::Object operations + private static String[] __ids = { + "IDL:calculator/idl/CalculatorCORBAService:1.0"}; + + public String[] _ids () + { + return (String[])__ids.clone (); + } + + private void readObject (java.io.ObjectInputStream s) throws java.io.IOException + { + String str = s.readUTF (); + String[] args = null; + java.util.Properties props = null; + org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str); + org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); + _set_delegate (delegate); + } + + private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException + { + String[] args = null; + java.util.Properties props = null; + String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this); + s.writeUTF (str); + } +} // class _CalculatorCORBAServiceStub diff --git a/java/sca/contrib/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl b/java/sca/contrib/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl new file mode 100644 index 0000000000..5848bbaa2c --- /dev/null +++ b/java/sca/contrib/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Compile by: idlj -fclient -oldImplBase CalculatorCORBA.idl + */ + +module calculator { + module idl { + interface CalculatorCORBAService { + double add(in double arg1, in double arg2); + double subtract(in double arg1, in double arg2); + double multiply(in double arg1, in double arg2); + double divide(in double arg1, in double arg2); + }; + }; +}; \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-distributed/README b/java/sca/contrib/samples/calculator-distributed/README new file mode 100644 index 0000000000..51f4b07e81 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/README @@ -0,0 +1,438 @@ +Calculator Distributed Sample +============================= +This sample implements a simple calculator using SCA components. It uses +exactly the same calculator application classes as the calculator sample but +runs the application distributed across three nodes. + +A node in this sample means an instance of the Tuscany SCA java runtime running +in a Java virtual machine. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open four command prompts and +navigate to this sample directory in each one. There is one command to be run +in each command prompt: + +ant runDomain +ant runNodeB +ant runNodeC +ant runNodeA + +Please run the commands in this order. + +OR if you don't have ant, on Windows use + +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchDomain +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeB +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeC +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeA + +and on *nix do + +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchDomain +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeB +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeC +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeA + + +The processes started on each of these command prompts can be ended by pressing +the key. + + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. NodeA exercises this interface by calling add, subtract, multiply and +divide operations. + +In the case of add and subtract the runtime recognises that +it can't find these services locally and, using the remote (web services) +version of the default SCA binding, contacts the add service running in NodeB +and the subtract service running in NodeC. + +On the command prompt where you started NodeA, you see the output of invoking the +calculator functions distributed over NodeB and and NodeC. On the command prompts +where you have started NodeB and NodeC, you see log messages that indicate that +the add and subtract services where called on these nodes respectively. + +The sample demonstrates that the calculator application can be distributed +across multiple nodes with no change to the application or to the SCA description +files. + +The domain node makes available a web application through which the contributions and +composites used in this sample can be navigated. One you have run "ant runDomain" you can +point you browser at: + +http://localhost:9990/ui/workspace/ + +The contents of the sample are as follows: + +calculator/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component, calls +-/* as + appropriate + AddService.java - adds two numbers + AddServiceImpl.java + SubtractService.java - subtracts one number from another + SubtractServiceImpl.java + MultiplyService.java - multiplies two numbers + MultiplyServiceImpl.java + DivideService.java - divides one number by another + DivideServiceImpl.java + node/ + LaunchCalculatorNodeA.java - runs an sca node configured with the + composite describing the main calculator + application. If you look inside this class + you will see that the node is configured + using a URL of the form: + + http://localhost:9990/node-config/NodeA + + This retrieves the information required + to configure NodeA from the domain. + + Once the node has been started this launcher + then finds the calculator service and + calls the various methods. + + LaunchCalculatorNodeB&C.java - These launchers start nodes B and C + which runs the add and subtract services. + + Unlike NodeA though these launchers just + wait once the node has been started. They + will service incomming web service requests + as they arrive. + + LaunchDomain.java - the node that provides the domain + configuration to the distributed + nodes + resources/ + cloud - The SCA composite files that describe + the configuration of each node + nodeA - the SCA assembly for nodeA's part of the + calculator application + nodeB - the SCA assembly for nodeB's part of the + calculator application + nodeC - the SCA assembly for nodeC's part of the + calculator application + test/ + java/ + calculator/ + CalculatorDistributedTestCase.java - JUnit test case which runs all + of the separate nodes along with the domain + in a single VM for test purposes + calculator-distributed.png - a pictorial representation of the sample + .composite files + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator-distributed +ant compile +ant runDomain +ant runNodeB +ant runNodeC +ant runNodeA + +You should see the following output from the four separate command prompt: + +runDomain: +ted>ant runDomain +Buildfile: build.xml + +runDomain: + [java] 26-Mar-2008 12:55:12 org.apache.tuscany.sca.node.launcher.DomainMana +gerLauncher main + [java] INFO: Apache Tuscany SCA Domain Manager starting... + [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 +\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- +1.2-incubating-SNAPSHOT\lib + [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ +distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 +.2-incubating-SNAPSHOT\modules + [java] 26-Mar-2008 12:55:19 org.apache.catalina.core.StandardEngine start + [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.14 + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.ContextConfig defau +ltWebConfig + [java] INFO: No default web.xml + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0. +xsd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_1. +xsd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_1_1.dtd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_1_2.dtd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_2_0.xsd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_2_1.xsd + [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg +ister + [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser +vices_1_1.xsd + [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol init + [java] INFO: Initializing Coyote HTTP/1.1 on http-9990 + [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol start + [java] INFO: Starting Coyote HTTP/1.1 on http-9990 + [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/home/* + [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/workspace/* + [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/files/* + [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/composite/* + [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/cloud/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/workspace/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/contribution/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/feed/files/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/files/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-source/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/deployable/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-resolved/ +* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud-source/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-config/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/node-config/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/quickstart/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/processes/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/node/processes/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer + addServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:9990/ping/* + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana +gerLauncher main + [java] INFO: SCA Domain Manager started. + [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana +gerLauncher main + [java] INFO: Press enter to shutdown. + + +runNodeB: + [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: Apache Tuscany SCA Node starting... + [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeB + + [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 +\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- +1.2-incubating-SNAPSHOT\lib + [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ +distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 +.2-incubating-SNAPSHOT\modules + [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.impl.NodeImpl + [java] INFO: Creating node: http://localhost:9990/node-config/NodeB + [java] 26-Mar-2008 12:55:45 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist +ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i +ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeB/ + [java] 26-Mar-2008 12:55:46 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co +mposite:nodeB;http://sample;CalculatorB + [java] 26-Mar-2008 12:55:47 org.apache.tuscany.sca.node.impl.NodeImpl start + + [java] INFO: Starting node: http://localhost:9990/node-config/NodeB + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8200/AddServiceComponent +B + [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: SCA Node started. + [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: Press enter to shutdown. + [java] AddService - add 3.0 and 2.0 + +runNodeC: + [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: Apache Tuscany SCA Node starting... + [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeC + + [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 +\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- +1.2-incubating-SNAPSHOT\lib + [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch +erUtil collectJARFiles + [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ +distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 +.2-incubating-SNAPSHOT\modules + [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.impl.NodeImpl + [java] INFO: Creating node: http://localhost:9990/node-config/NodeC + [java] 26-Mar-2008 12:56:03 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist +ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i +ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeC/ + [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co +mposite:nodeC;http://sample;CalculatorC + [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl start + + [java] INFO: Starting node: http://localhost:9990/node-config/NodeC + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8300/SubtractServiceComp +onentC + [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: SCA Node started. + [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch +er main + [java] INFO: Press enter to shutdown. + [java] SubtractService - subtract 3.0 and 2.0 + +runNodeA: + [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.impl.NodeImpl + [java] INFO: Creating node: http://localhost:9990/node-config/NodeA + [java] 26-Mar-2008 12:56:12 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist +ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i +ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeA/ + [java] 26-Mar-2008 12:56:13 org.apache.tuscany.sca.node.impl.NodeImpl confi +gureNode + [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co +mposite:nodeA;http://sample;CalculatorA + [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co +mpositeBuilderImpl$1 problem + [java] WARNING: Component reference target not found, it might be a remote +service: SubtractServiceComponentC + [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co +mpositeBuilderImpl$1 problem + [java] WARNING: Component reference target not found, it might be a remote +service: AddServiceComponentB + [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.node.impl.NodeImpl start + + [java] INFO: Starting node: http://localhost:9990/node-config/NodeA + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] CalculatorService - add 3.0 and 2.0 + [java] 3 + 2=5.0 + [java] CalculatorService - subtract 3.0 and 2.0 + [java] 3 - 2=1.0 + [java] CalculatorService - multiply 3.0 and 2.0 + [java] 3 * 2=6.0 + [java] CalculatorService - divide 3.0 and 2.0 + [java] 3 / 2=1.5 + [java] 26-Mar-2008 12:56:20 org.apache.tuscany.sca.node.impl.NodeImpl stop + [java] INFO: Stopping node: http://localhost:9990/node-config/NodeA + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When running from Maven the four nodes all run within +Java virtual machine. + +cd calculator-distributed +mvn + +You should see the following output at the end of the test phase. + +INFO: Starting node: http://localhost:9990/node-config/NodeA +CalculatorService - add 3.0 and 2.0 +AddService - add 3.0 and 2.0 +CalculatorService - subtract 3.0 and 2.0 +SubtractService - subtract 3.0 and 2.0 +CalculatorService - multiply 3.0 and 2.0 +CalculatorService - divide 3.0 and 2.0 +26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: http://localhost:9990/node-config/NodeC +26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: http://localhost:9990/node-config/NodeB +26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: http://localhost:9990/node-config/NodeA +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.328 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. + + + diff --git a/java/sca/contrib/samples/calculator-distributed/build.xml b/java/sca/contrib/samples/calculator-distributed/build.xml new file mode 100644 index 0000000000..cccd22f3ae --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/build.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/calculator-distributed.png b/java/sca/contrib/samples/calculator-distributed/calculator-distributed.png new file mode 100644 index 0000000000..7c0e175664 Binary files /dev/null and b/java/sca/contrib/samples/calculator-distributed/calculator-distributed.png differ diff --git a/java/sca/contrib/samples/calculator-distributed/calculator-distributed.svg b/java/sca/contrib/samples/calculator-distributed/calculator-distributed.svg new file mode 100644 index 0000000000..be5a4b8185 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/calculator-distributed.svg @@ -0,0 +1,383 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + + nodeB nodeC + nodeA + diff --git a/java/sca/contrib/samples/calculator-distributed/cloud.composite b/java/sca/contrib/samples/calculator-distributed/cloud.composite new file mode 100644 index 0000000000..85e2f9c7f3 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/cloud.composite @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/domain.composite b/java/sca/contrib/samples/calculator-distributed/domain.composite new file mode 100644 index 0000000000..643e22d0cf --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/domain.composite @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/pom.xml b/java/sca/contrib/samples/calculator-distributed/pom.xml new file mode 100644 index 0000000000..e1e86d8896 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/pom.xml @@ -0,0 +1,119 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-distributed + Apache Tuscany SCA Distributed Calculator Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-domain-manager + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-SNAPSHOT + runtime + + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..dd7ecb827d --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The Add service interface + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e9b7e254e5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + System.out.println("AddService - add " + n1 + " and " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..c927500cc7 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + public double add(double n1, double n2) { + System.out.println("CalculatorService - add " + n1 + " and " + n2); + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + System.out.println("CalculatorService - subtract " + n1 + " and " + n2); + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + System.out.println("CalculatorService - multiply " + n1 + " and " + n2); + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + System.out.println("CalculatorService - divide " + n1 + " and " + n2); + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..f7ac0b7287 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..b7dca792b2 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..f03b9b94d4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the multiply service + */ +@Remotable +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1010207154 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + System.out.println("SubtractService - subtract " + n1 + " and " + n2); + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java new file mode 100644 index 0000000000..87021505b3 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.launcher.NodeLauncher; +import org.oasisopen.sca.ServiceRuntimeException; + +import calculator.CalculatorService; + +public class LaunchCalculatorNodeA { + public static void main(String[] args) throws Exception { + + SCANode node = null; + try { + + NodeLauncher nodeLauncher = NodeLauncher.newInstance(); + node = nodeLauncher.createNodeFromURL("http://localhost:9990/node-config/NodeA"); + + node.start(); + + // get a reference to the calculator component + SCAClient client = (SCAClient)node; + CalculatorService calculatorService = + client.getService(CalculatorService.class, "CalculatorServiceComponentA"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + if (args.length > 1){ + for (int i=0; i < 1000; i++){ + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + } + } + + node.stop(); + + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java new file mode 100644 index 0000000000..50600eaedc --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchCalculatorNodeB { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeB"}); + } +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java new file mode 100644 index 0000000000..95d8934665 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchCalculatorNodeC { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"}); + } +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java new file mode 100644 index 0000000000..8b4fe566a1 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/java/node/LaunchDomain.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package node; + +import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; + +/** + * This server program that loads a composite to provide simple registry function. + * This server can be replaced with any registry that is appropriate but the components + * in each node that talk to the registry should be replaced also. + */ +public class LaunchDomain { + public static void main(String[] args) throws Exception { + DomainManagerLauncher.main(args); + } + +} diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite new file mode 100644 index 0000000000..ed7fe55abc --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite new file mode 100644 index 0000000000..8f29cc17aa --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite new file mode 100644 index 0000000000..9ad132b0d4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite new file mode 100644 index 0000000000..172676a3c7 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..1b1c0291e2 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite new file mode 100644 index 0000000000..b770dbe8d4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6c0ffe4ac0 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite new file mode 100644 index 0000000000..66caf0d17b --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8c311553c3 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/java/sca/contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java new file mode 100644 index 0000000000..2a6f3af002 --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java @@ -0,0 +1,92 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +import junit.framework.Assert; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Runs a distributed domain in a single VM by using and in memory + * implementation of the distributed domain + */ +public class CalculatorDistributedTestCase { + + private static SCANode manager; + private static SCANode nodeA; + private static SCANode nodeB; + private static SCANode nodeC; + + private static CalculatorService calculatorService; + + + @BeforeClass + public static void init() throws Exception { + + try { + System.out.println("Setting up domain"); + + DomainManagerLauncher managerLauncher = DomainManagerLauncher.newInstance(); + manager = managerLauncher.createDomainManager(); + manager.start(); + + SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); + nodeC = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeC"); + nodeB = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeB"); + nodeA = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeA"); + + nodeC.start(); + nodeB.start(); + nodeA.start(); + + SCAClient client = (SCAClient)nodeA; + calculatorService = + client.getService(CalculatorService.class, "CalculatorServiceComponentA"); + + } catch(Exception ex){ + System.err.println(ex.toString()); + } + + } + + @AfterClass + public static void destroy() throws Exception { + nodeC.stop(); + nodeB.stop(); + nodeA.stop(); + manager.stop(); + } + + @Test + public void testCalculator() throws Exception { + + // Calculate + Assert.assertEquals(calculatorService.add(3, 2), 5.0); + Assert.assertEquals(calculatorService.subtract(3, 2), 1.0); + Assert.assertEquals(calculatorService.multiply(3, 2), 6.0); + Assert.assertEquals(calculatorService.divide(3, 2), 1.5); + } +} diff --git a/java/sca/contrib/samples/calculator-distributed/workspace.xml b/java/sca/contrib/samples/calculator-distributed/workspace.xml new file mode 100644 index 0000000000..7d6d3dbdbd --- /dev/null +++ b/java/sca/contrib/samples/calculator-distributed/workspace.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-implementation-policies/README b/java/sca/contrib/samples/calculator-implementation-policies/README new file mode 100644 index 0000000000..bd66eee1c9 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/README @@ -0,0 +1,266 @@ +Calculator Implementation Policies Sample +========================================= +This sample builds over simple calculator sample to demonstrate how Implementation Policies can +be use in Tuscany SCA Java. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run the sample to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient + + +Sample Overview +--------------- +The sample provides the calculator service with a default SCA (java) binding. The 'logging' policy +which is handled by the Tuscany SCA java policy-logging module is used in this calculator +composite to specify the need for 'logging'. The MultiplyService Component specifies for 'jassAuthentication' +which is one way of implemention login authentication, using the Java Authentication and Authorization Service. + +The logging intent and policyset that is to be used by this calculator application must be +defined in the definitions.xml file. Here we use the policyset structure already defined in +Tuscany for logging under the policy-logging and hence there is no need to specify the policyset processors +and policy handler classes as part of this application. + +Similarly the jaasAuthentication intent and policyset also is defined in the definitions.xml file +of this sample. This sample uses the calculator.security.JaasLoginModule class for handling the +authentication functions. Right now there is a simply matching of userid and passwords that happens in this +class. Applications could implement their own sophisticated authentication mechanisms. For more information +on how to do this please look up Java Authentication and Authorization Service documentation. The sample +also use the calculator.security.CalculatorCallbackHandler to fetch the userid and password to be use for the +login authentication. This handler presently uses hardcoded userids and passwords. Applications could +typically use this handler to prompt for userid and passwords. + +There are two components that provide the calculator service namely 'CalculatorServiceComponent' +and 'AnotherCalculatorServiceComponent'. The logging intent is specified for the 'subtract' and 'divide' +operations of the 'CalculatorServiceCompnent' implementation, and on the entire implementation +(i.e. all operations) for the AddServiceComponent and AnotherCalculatorServiceComponent. + +The CalculatorClient first exercises the CalculatorServiceComponent calling add, +subtract, multiply and divide operations. This results in logging messages appearing on the +console for 'add', 'subtract' and 'divide' operations. The CalculatorClient then exercises the +AnotherCalculatorServiceComponent calling all the service methods. This will result in logging messages +printed on the console for all the operations. For the 'add' operation there will be two sets of messages +printed - one that has resulted from specifying the 'logging' intent on the implementation element of the +'AnotherCalculatorServiceComponent' and another from specifying the 'logging' intent on the +'AddServiceComponent' + +The jaasAuthentication intent is specified for the 'MultiplyServiceComponent'. So everytime this component +is invoke an authentication is attempted and only if it succeeds, is the multiply function is invoked. The +console prints messages that denote if the authentication has succeeded or failed. + +Thus this sample demonstrates how intents could be applied to either implementations as a whole or to some +selective operations on an implementation. + + +calculator/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component, calls +-/* as + appropriate + CalculatorServiceImpl.java + AddService.java - adds two numbers + AddServiceImpl.java + SubtractService.java - subtracts one number from another + SubtractServiceImpl.java + MultiplyService.java - multiplies two numbers + MultiplyServiceImpl.java + DivideService.java - divides one number by another + DivideServiceImpl.java + CalculatorClient.java - starts the SCA Runtime and + deploys the Calculator.composite. + It then calls the deployed Calculator + Components services + calculator/security + JaasLoginModule.java JaasLoginModule implementation for this sample + CalculatorCallbackHandler.java JAAS callbackhandler for fetching userid and password + + + resources/ + Calculator.composite - the SCA assembly for this sample + definitions.xml - sca definitions file that defines the 'logging' intent + and policyset + used by this application + CalculatorLogMessages.properties - A resource bundle contain the log messages to be + used. + CalculatorJaas.config - JAAS Login Configuration file + + test/ + java/ + calculator/ + CalculatorTestCase.java - JUnit test case + calculator.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator-implementation-policies +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Calling CalculatorServiceComponent configured with 'logging' policy for subtract and divide operations... + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - add + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - add + [java] 3 + 2=5.0 + [java] 3 - 2=1.0 + [java] 3 * 2=6.0 + [java] 3 / 2=1.5 + [java] Calling CalculatorServiceComponent configured with 'logging' for all operations in the implementation... + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - subtract + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - subtract + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - divide + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - divide + [java] Nov 23, 2007 1:06:10 PM + [java] 3 + 2=5.0 + [java] 3 - 2=1.0 + [java] 3 * 2=6.0 + [java] INFO: Invoking operation - add + [java] 3 / 2=1.5 + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - add + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - add + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - add + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - subtract + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - subtract + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - multiply + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - multiply + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Invoking operation - divide + [java] Nov 23, 2007 1:06:10 PM + [java] INFO: Returned from operation - divide + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator +mvn + +You should see the following output from the test phase. Notice the log messages. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorTestCase +Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error +WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/ +classes/Calculator.composite, line: 28, column: 4 +cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www. +osoa.org/xmlns/sca/1.0"]}' is expected. +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - add +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation add with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - add +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation add with return value 5 +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - subtract +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation subtract with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - subtract +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation subtract with return value 1 +Successfully AUTHENTICATED!! +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - divide +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation divide with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - divide +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation divide with return value 1.5 +Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error +WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/ +classes/Calculator.composite, line: 28, column: 4 +cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www. +osoa.org/xmlns/sca/1.0"]}' is expected. +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - add +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation add with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - add +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation add with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - add +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation add with return value 5 +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - add +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation add with return value 5 +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - subtract +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation subtract with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - subtract +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation subtract with return value 1 +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - multiply +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation multiply with arguments 3.0, 2.0, +Successfully AUTHENTICATED!! +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - multiply +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation multiply with return value 6 +Dec 18, 2007 12:05:06 PM +INFO: Invoking operation - divide +Dec 18, 2007 12:05:06 PM +FINER: Inovoking operation divide with arguments 3.0, 2.0, +Dec 18, 2007 12:05:06 PM +INFO: Returned from operation - divide +Dec 18, 2007 12:05:06 PM +FINER: Returning from operation divide with return value 1.5 +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.823 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/calculator-implementation-policies/build.xml b/java/sca/contrib/samples/calculator-implementation-policies/build.xml new file mode 100644 index 0000000000..7afa23a07f --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-implementation-policies/calculator.png b/java/sca/contrib/samples/calculator-implementation-policies/calculator.png new file mode 100644 index 0000000000..995a57b1fd Binary files /dev/null and b/java/sca/contrib/samples/calculator-implementation-policies/calculator.png differ diff --git a/java/sca/contrib/samples/calculator-implementation-policies/calculator.svg b/java/sca/contrib/samples/calculator-implementation-policies/calculator.svg new file mode 100644 index 0000000000..af34f07e04 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/calculator.svg @@ -0,0 +1,329 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + diff --git a/java/sca/contrib/samples/calculator-implementation-policies/pom.xml b/java/sca/contrib/samples/calculator-implementation-policies/pom.xml new file mode 100644 index 0000000000..7bc0be2dca --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-impl-policies + Apache Tuscany SCA Calculator Sample using Implementation Policies + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + org.apache.tuscany.sca + tuscany-policy-logging + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-policy-security + 2.0-SNAPSHOT + runtime + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..5a1e7a638a --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..caf4d358df --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..2bce187049 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import javax.security.auth.login.Configuration; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + try { + Configuration secConf = Configuration.getConfiguration(); + } catch (java.lang.SecurityException e) { + System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader() + .getResource("CalculatorJass.config").toString()); + } + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + + "policy for subtract and divide operations..."); + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + calculatorService = + scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); + + // Calculate + System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + + "for all operations in the implementation..."); + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ad87375529 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..d3fa7a8f41 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..ef6a8b375b --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..cd91935f08 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c85357fcd8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..56ee372fc4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1b669084d9 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java new file mode 100644 index 0000000000..b48fb90148 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; + +/** + * @version $Rev$ $Date$ + */ +public class CalculatorCallbackHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + if (callbacks[i] instanceof NameCallback) { + NameCallback nc = (NameCallback)callbacks[i]; + nc.setName("CalculatorUser"); + } else if (callbacks[i] instanceof PasswordCallback) { + PasswordCallback pc = (PasswordCallback)callbacks[i]; + pc.setPassword("CalculatorUserPasswd".toCharArray()); + } else { + throw new UnsupportedCallbackException + (callbacks[i], "Unsupported Callback!"); + } + } + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java new file mode 100644 index 0000000000..fe4097640b --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator.security; + +import java.security.Principal; +import java.util.Map; + +import javax.security.auth.Subject; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.login.LoginException; +import javax.security.auth.spi.LoginModule; + +/** + * @version $Rev$ $Date$ + */ +public class JaasLoginModule implements LoginModule { + + private CallbackHandler callbackHandler; + private Subject subject; + private Principal userPrincipal; + private String userId; + private String password; + private boolean succeeded; + private boolean commitSucceeded; + + public void initialize(Subject subject, + CallbackHandler callbackHandler, + Map sharedState, + Map options) { + this.callbackHandler = callbackHandler; + this.subject = subject; + } + + public boolean login() throws LoginException { + Callback[] callbacks = new Callback[2]; + callbacks[0] = new NameCallback("UserId:"); + callbacks[1] = new PasswordCallback("Password:", false); + + try { + callbackHandler.handle(callbacks); + userId = ((NameCallback)callbacks[0]).getName(); + password = new String(((PasswordCallback)callbacks[1]).getPassword()); + + if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) { + System.out.println("Successfully AUTHENTICATED!!"); + succeeded = true; + return true; + } else { + System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!"); + return false; + } + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + /** + *

This method is called if the LoginContext's + * overall authentication succeeded + * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules + * succeeded). + * + *

If this LoginModule's own authentication attempt + * succeeded (checked by retrieving the private state saved by the + * login method), then this method associates a + * UserPrincipal + * with the Subject located in the + * LoginModule. If this LoginModule's own + * authentication attempted failed, then this method removes + * any state that was originally saved. + * + *

+ * + * @exception LoginException if the commit fails. + * + * @return true if this LoginModule's own login and commit + * attempts succeeded, or false otherwise. + */ + public boolean commit() throws LoginException { + if (succeeded == false) { + return false; + } else { + // add a Principal (authenticated identity) to the Subject + + // assume the user we authenticated is the UserPrincipal + userPrincipal = new UserPrincipal(userId); + if (!subject.getPrincipals().contains(userPrincipal)) + subject.getPrincipals().add(userPrincipal); + + // in any case, clean out state + userId = null; + password = null; + commitSucceeded = true; + return true; + } + } + + /** + *

This method is called if the LoginContext's + * overall authentication failed. + * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules + * did not succeed). + * + *

If this LoginModule's own authentication attempt + * succeeded (checked by retrieving the private state saved by the + * login and commit methods), + * then this method cleans up any state that was originally saved. + * + *

+ * + * @exception LoginException if the abort fails. + * + * @return false if this LoginModule's own login and/or commit attempts + * failed, and true otherwise. + */ + public boolean abort() throws LoginException { + if (succeeded == false) { + return false; + } else if (succeeded == true && commitSucceeded == false) { + // login succeeded but overall authentication failed + succeeded = false; + userId = null; + password = null; + userPrincipal = null; + } else { + // overall authentication succeeded and commit succeeded, + // but someone else's commit failed + logout(); + } + return true; + } + + /** + * Logout the user. + * + *

This method removes the SimplePrincipal + * that was added by the commit method. + * + *

+ * + * @exception LoginException if the logout fails. + * + * @return true in all cases since this LoginModule + * should not be ignored. + */ + public boolean logout() throws LoginException { + subject.getPrincipals().remove(userPrincipal); + succeeded = false; + succeeded = commitSucceeded; + userId = null; + if (password != null) + password = null; + userPrincipal = null; + return true; + } + +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java new file mode 100644 index 0000000000..595626e672 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java @@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package calculator.security; + +import java.security.Principal; + +/** + * @version $Rev$ $Date$ + */ +public class UserPrincipal implements Principal { + + private final String name; + + public UserPrincipal(String name) { + if (name == null) + throw new IllegalArgumentException("name cannot be null"); + this.name = name; + } + + public String getName() { + return name; + } + + public String toString() { + return name; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final UserPrincipal other = (UserPrincipal)obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } +} diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..d91bf88d96 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/Calculator.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config new file mode 100644 index 0000000000..0e7cb86633 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config @@ -0,0 +1,3 @@ +Calculator { + calculator.security.JaasLoginModule required debug=true; +}; diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties new file mode 100644 index 0000000000..f62125eaa9 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +CALLING_OPERATION=Inovoking operation {0} with arguments {1} +OPERATION_RETURNED=Returning from operation {0} with return value {1} \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/definitions.xml b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/definitions.xml new file mode 100644 index 0000000000..6cccde0d13 --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/main/resources/definitions.xml @@ -0,0 +1,40 @@ + + + + + + + + Calculator + calculator.security.CalculatorCallbackHandler + + + + + + + FINER + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java b/java/sca/contrib/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..157570c3df --- /dev/null +++ b/java/sca/contrib/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import javax.security.auth.login.Configuration; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase extends TestCase { + + private CalculatorService calculatorService; + private CalculatorService anotherCalculatorService; + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + try { + Configuration secConf = Configuration.getConfiguration(); + } catch ( java.lang.SecurityException e ) { + //FIXME: We should not compare exception strings as they are localized in various languages + //if ( e.getMessage().equals("Unable to locate a login configuration") ) { + System.setProperty("java.security.auth.login.config", + this.getClass().getClassLoader().getResource("CalculatorJass.config").toString()); + //} else { + // throw e; + //} + } + scaDomain = SCADomain.newInstance("Calculator.composite"); + calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + anotherCalculatorService = scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCalculator() throws Exception { + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + } + + public void testAnotherCalculator() throws Exception { + // Calculate + assertEquals(anotherCalculatorService.add(3, 2), 5.0); + assertEquals(anotherCalculatorService.subtract(3, 2), 1.0); + assertEquals(anotherCalculatorService.multiply(3, 2), 6.0); + assertEquals(anotherCalculatorService.divide(3, 2), 1.5); + } +} diff --git a/java/sca/contrib/samples/calculator-lean/README b/java/sca/contrib/samples/calculator-lean/README new file mode 100644 index 0000000000..a8aff232c6 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/README @@ -0,0 +1,87 @@ +Calculator Sample +================= +This sample implements a simple calculator using SCA components. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +java -jar /modules/tuscany-node-launcher.jar Calculator.composite target/sample-calculator-lean.jar + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite across the local wires. + +calculator/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component, calls +-/* as + appropriate + CalculatorServiceImpl.java + AddService.java - adds two numbers + AddServiceImpl.java + SubtractService.java - subtracts one number from another + SubtractServiceImpl.java + MultiplyService.java - multiplies two numbers + MultiplyServiceImpl.java + DivideService.java - divides one number by another + DivideServiceImpl.java + CalculatorClient.java - a client component that calls the + Calculator services + resources/ + Calculator.composite - the SCA assembly for this sample + test/ + java/ + calculator/ + CalculatorTestCase.java - JUnit test case + calculator.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 3 + 2=5.0 + [java] 3 - 2=1.0 + [java] 3 * 2=6.0 + [java] 3 / 2=1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/calculator-lean/calculator.png b/java/sca/contrib/samples/calculator-lean/calculator.png new file mode 100644 index 0000000000..995a57b1fd Binary files /dev/null and b/java/sca/contrib/samples/calculator-lean/calculator.png differ diff --git a/java/sca/contrib/samples/calculator-lean/calculator.svg b/java/sca/contrib/samples/calculator-lean/calculator.svg new file mode 100644 index 0000000000..0615925c50 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/calculator.svg @@ -0,0 +1,329 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + diff --git a/java/sca/contrib/samples/calculator-lean/pom.xml b/java/sca/contrib/samples/calculator-lean/pom.xml new file mode 100644 index 0000000000..a68887b9b5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/pom.xml @@ -0,0 +1,71 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-lean + Apache Tuscany SCA Calculator Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..7ca8fb04b5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..d56aa86e09 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +@Scope("COMPOSITE") @EagerInit +public class CalculatorClient { + + private CalculatorService calculatorService; + + @Reference + public void setCalculatorService(CalculatorService calculatorService) { + this.calculatorService = calculatorService; + } + + @Init + public void calculate() { + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..17fad7de6b --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..1323edf55a --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..91b803bc9e --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..58cc4a3547 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-lean/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator-lean/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..913081b9be --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/resources/Calculator.composite @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-lean/src/main/resources/CalculatorTest.composite b/java/sca/contrib/samples/calculator-lean/src/main/resources/CalculatorTest.composite new file mode 100644 index 0000000000..906e2a3918 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/main/resources/CalculatorTest.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java b/java/sca/contrib/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..94dc747734 --- /dev/null +++ b/java/sca/contrib/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * This shows how to test the Calculator composition. + */ +@Scope("COMPOSITE") @EagerInit +public class CalculatorTestCase extends TestCase { + + private static CalculatorService calculatorService; + private SCANode node; + + @Reference + public void setCalculatorService(CalculatorService calculatorService) { + CalculatorTestCase.calculatorService = calculatorService; + } + + @Override + protected void setUp() throws Exception { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANodeFromClassLoader("CalculatorTest.composite", getClass().getClassLoader()); + node.start(); + } + + @Override + protected void tearDown() throws Exception { + node.stop(); + } + + public void testCalculator() throws Exception { + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + } +} diff --git a/java/sca/contrib/samples/calculator-rcp/build.properties b/java/sca/contrib/samples/calculator-rcp/build.properties new file mode 100644 index 0000000000..0530eb648b --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/build.properties @@ -0,0 +1,5 @@ +source.. = src/main/java/ +output.. = target/classes/ +bin.includes = plugin.xml,\ + META-INF/,\ + . diff --git a/java/sca/contrib/samples/calculator-rcp/icons/alt_window_16.gif b/java/sca/contrib/samples/calculator-rcp/icons/alt_window_16.gif new file mode 100644 index 0000000000..05626b17d8 Binary files /dev/null and b/java/sca/contrib/samples/calculator-rcp/icons/alt_window_16.gif differ diff --git a/java/sca/contrib/samples/calculator-rcp/icons/alt_window_32.gif b/java/sca/contrib/samples/calculator-rcp/icons/alt_window_32.gif new file mode 100644 index 0000000000..b432f88339 Binary files /dev/null and b/java/sca/contrib/samples/calculator-rcp/icons/alt_window_32.gif differ diff --git a/java/sca/contrib/samples/calculator-rcp/plugin.xml b/java/sca/contrib/samples/calculator-rcp/plugin.xml new file mode 100644 index 0000000000..1fb5acd9b5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/plugin.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-rcp/pom.xml b/java/sca/contrib/samples/calculator-rcp/pom.xml new file mode 100644 index 0000000000..0e5214cdd0 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/pom.xml @@ -0,0 +1,126 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample.calculator.rcp + Apache Tuscany SCA Calculator RCP Sample + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-extensibility-equinox + 2.0-SNAPSHOT + runtime + + + org.apache.tuscany.sca + tuscany-node-launcher-equinox + 2.0-SNAPSHOT + compile + + + + javax.servlet + servlet-api + 2.5 + provided + + + junit + junit + 4.5 + test + + + + ${artifactId} + + + maven-eclipse-plugin + 2.5.1 + + + org.eclipse.pde.ManifestBuilder + org.eclipse.jdt.core.javabuilder + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + + org.eclipse.jdt.launching.JRE_CONTAINER + + org.eclipse.pde.core.requiredPlugins + + + + + + maven-jar-plugin + + + ${basedir}/META-INF/MANIFEST.MF + + + + + + diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/Calculator.composite b/java/sca/contrib/samples/calculator-rcp/src/main/java/Calculator.composite new file mode 100644 index 0000000000..913081b9be --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/Calculator.composite @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..7ca8fb04b5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..afd5ea48fc --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +@Scope("COMPOSITE") +@EagerInit +public class CalculatorClient { + + private CalculatorService calculatorService; + + @Reference + public void setCalculatorService(CalculatorService calculatorService) { + this.calculatorService = calculatorService; + } + + @Init + public void calculate() { + // Calculate + System.out.println("SCA API ClassLoader: " + Reference.class.getClassLoader()); + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..c89043276e --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..39f55ca31f --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..1323edf55a --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..91b803bc9e --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..58cc4a3547 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java new file mode 100644 index 0000000000..50f68dcb01 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import java.io.File; + +import org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoverer; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.apache.tuscany.sca.sample.calculator.rcp"; + + // The shared instance + private static Activator plugin; + + private SCANode node; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + Class cls = EquinoxServiceDiscoverer.class; + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANode("Calculator.composite", new SCAContribution("c1", new File("target/classes").toURI().toString())); + node.start(); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + if (node != null) { + node.stop(); + } + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java new file mode 100644 index 0000000000..5ce6522fed --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + +/** + * This class controls all aspects of the application's execution + */ +public class Application implements IApplication { + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + public Object start(IApplicationContext context) { + Display display = PlatformUI.createDisplay(); + try { + int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); + if (returnCode == PlatformUI.RETURN_RESTART) { + return IApplication.EXIT_RESTART; + } + return IApplication.EXIT_OK; + } finally { + display.dispose(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#stop() + */ + public void stop() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench == null) + return; + final Display display = workbench.getDisplay(); + display.syncExec(new Runnable() { + public void run() { + if (!display.isDisposed()) + workbench.close(); + } + }); + } +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java new file mode 100644 index 0000000000..2fccfb2d77 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; + +/** + * An action bar advisor is responsible for creating, adding, and disposing of + * the actions added to a workbench window. Each window will be populated with + * new actions. + */ +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + + // Actions - important to allocate these only in makeActions, and then use + // them + // in the fill methods. This ensures that the actions aren't recreated + // when fillActionBars is called with FILL_PROXY. + private IWorkbenchAction exitAction; + + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } + + protected void makeActions(final IWorkbenchWindow window) { + // Creates the actions and registers them. + // Registering is needed to ensure that key bindings work. + // The corresponding commands keybindings are defined in the plugin.xml + // file. + // Registering also provides automatic disposal of the actions when + // the window is closed. + + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); + } + + protected void fillMenuBar(IMenuManager menuBar) { + MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); + menuBar.add(fileMenu); + fileMenu.add(exitAction); + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java new file mode 100644 index 0000000000..ac1893509c --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "org.apache.tuscany.sca.sample.calculator.rcp.perspective"; + + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 0000000000..6378decf20 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setInitialSize(new Point(400, 300)); + configurer.setShowCoolBar(false); + configurer.setShowStatusLine(false); + configurer.setTitle("Tuscany SCA Calculator RCP Application"); + } +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java new file mode 100644 index 0000000000..445b4b65b2 --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +public class Perspective implements IPerspectiveFactory { + + public void createInitialLayout(IPageLayout layout) { + String editorArea = layout.getEditorArea(); + layout.setEditorAreaVisible(false); + layout.setFixed(true); + + layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea); + } + +} diff --git a/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/View.java b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/View.java new file mode 100644 index 0000000000..f95c1e029c --- /dev/null +++ b/java/sca/contrib/samples/calculator-rcp/src/main/java/calculator/rcp/View.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.rcp; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.ViewPart; + +public class View extends ViewPart { + public static final String ID = "org.apache.tuscany.sca.sample.calculator.rcp.view"; + + private TableViewer viewer; + + /** + * The content provider class is responsible for providing objects to the + * view. It can wrap existing objects in adapters or simply return objects + * as-is. These objects may be sensitive to the current input of the view, + * or ignore it and always show the same content (like Task List, for + * example). + */ + class ViewContentProvider implements IStructuredContentProvider { + public void inputChanged(Viewer v, Object oldInput, Object newInput) { + } + + public void dispose() { + } + + public Object[] getElements(Object parent) { + return new String[] {"One", "Two", "Three"}; + } + } + + class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { + public String getColumnText(Object obj, int index) { + return getText(obj); + } + + public Image getColumnImage(Object obj, int index) { + return getImage(obj); + } + + public Image getImage(Object obj) { + return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); + } + } + + /** + * This is a callback that will allow us to create the viewer and initialize + * it. + */ + public void createPartControl(Composite parent) { + viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + viewer.setContentProvider(new ViewContentProvider()); + viewer.setLabelProvider(new ViewLabelProvider()); + viewer.setInput(getViewSite()); + } + + /** + * Passing the focus request to the viewer's control. + */ + public void setFocus() { + viewer.getControl().setFocus(); + } +} diff --git a/java/sca/contrib/samples/calculator-script/README b/java/sca/contrib/samples/calculator-script/README new file mode 100644 index 0000000000..ab1dda13df --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/README @@ -0,0 +1,105 @@ +Calculator Script Sample +======================== +This sample implements a simple calculator using SCA components implemented +using Java, JavaScript, Ruby, Python and Groovy. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-script.jar calculator.CalculatorClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-script.jar calculator.CalculatorClient + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing +to the appropriate components in the composite across the local wires. Each +component is implemented using a different language. + +calculator-script/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component calls +-/* as + appropriate + CalculatorServiceImpl.java + AddService.java - adds two numbers + SubtractService.java - subtracts one number from another + MultiplyService.java - multiplies two numbers + DivideService.java - divides one number by another + CalculatorClient.java - starts the SCA Runtime and + deploys the Calculator.composite. + It then calls the deployed Calculator + Components services + resources/ + calculator/ + AddServiceImpl.js - A JavaScript implementation of the + Add component + SubtractServiceImpl.rb - A Ruby implementation of the Subtract + component + MultiplyServiceImpl.py - A Python implementation of the + Multiple component + DivideServiceImpl.groovy- A Groovy implementation of the + Divide component + Calculator.composite - the SCA assembly for this sample + + test/ + java/ + calculator/ + CalculatorTestCase.java - JUnit test case + calculator-script.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator-script +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 3 + 2=5.0 + [java] 3 - 2=1.0 + [java] 3 * 2=6.0 + [java] 3 / 2=1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-script +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.918 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/calculator-script/build.xml b/java/sca/contrib/samples/calculator-script/build.xml new file mode 100644 index 0000000000..429d638ca5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-script/calculator-script.png b/java/sca/contrib/samples/calculator-script/calculator-script.png new file mode 100644 index 0000000000..d3f8c491c3 Binary files /dev/null and b/java/sca/contrib/samples/calculator-script/calculator-script.png differ diff --git a/java/sca/contrib/samples/calculator-script/calculator-script.svg b/java/sca/contrib/samples/calculator-script/calculator-script.svg new file mode 100644 index 0000000000..16939f9310 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/calculator-script.svg @@ -0,0 +1,334 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent(Java) + + + CalculatorService + AddServiceComponent(Javascript) + + SubtractServiceComponent(Ruby) + + MultiplyServiceComponent(Python) + + DivideServiceComponent(Groovy) + addService + subtractService + multiplyService + divideService + + + + + + diff --git a/java/sca/contrib/samples/calculator-script/pom.xml b/java/sca/contrib/samples/calculator-script/pom.xml new file mode 100644 index 0000000000..4ed19c0751 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-script + Apache Tuscany SCA Calculator Sample using Scripting Languages + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-script + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..a235e648c7 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the add service + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..243d1562dc --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..c89043276e --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..39f55ca31f --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..497dafd4fd --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..376b3e5bb9 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-script/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator-script/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..8a765e6153 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/resources/Calculator.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js new file mode 100644 index 0000000000..1d4d221364 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function add(n1, n2) { + return n1 + n2; +} \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy new file mode 100644 index 0000000000..c31c1e8fd6 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def divide(n1, n2) { + return n1 / n2 +} \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py new file mode 100644 index 0000000000..d6f27ca7f5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +def multiply(n1, n2): + return n1 * n2 \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb new file mode 100644 index 0000000000..132a1d13b0 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +def subtract(n1, n2) + return n1 - n2 +end \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java b/java/sca/contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..fea8f62110 --- /dev/null +++ b/java/sca/contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase extends TestCase { + + private SCADomain scaDomain; + private CalculatorService calculatorService; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("Calculator.composite"); + calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCalculator() throws Exception { + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + + } +} diff --git a/java/sca/contrib/samples/calculator-webapp/README b/java/sca/contrib/samples/calculator-webapp/README new file mode 100644 index 0000000000..c88b92b206 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/README @@ -0,0 +1,118 @@ +Calculator Sample +================= +This sample uses the same code as the calculator sample but deploys the +sample wrapped in a web app. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-calculator-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-webapp/calc.jsp + +The port and hostname will of course vary depending on your local installation. + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite across the local wires. + +calculator-webapp/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - As calculator sample + CalculatorServiceImpl.java + AddService.java - As calculator sample + AddServiceImpl.java + SubtractService.java - As calculator sample + SubtractServiceImpl.java + MultiplyService.java - As calculator sample + MultiplyServiceImpl.java + DivideService.java - As calculator sample + DivideServiceImpl.java + CalculatorClient.java - As calculator sample + resources/ + Calculator.composite - As calculator sample + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + calc.jsp - the web application that makes use of the + SCA application + test/ + java/ + calculator/ + CalculatorTestCase.java - JUnit test case + + calculator.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd calculator-webapp +ant package + +This should result in a war file (sample-calculator-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in you +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-webapp/calc.jsp + +The port and hostname will of course vary depending on your local installation. + +You should see the following output. + +Expression Result +2 + 3 5.0 +3 - 2 1.0 +3 * 2 6.0 +3 / 2 1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-webapp +mvn + + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.852 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +Again this should result in a war file (sample-calculator-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/calculator-webapp/calculator-web.png b/java/sca/contrib/samples/calculator-webapp/calculator-web.png new file mode 100644 index 0000000000..896ddc4093 Binary files /dev/null and b/java/sca/contrib/samples/calculator-webapp/calculator-web.png differ diff --git a/java/sca/contrib/samples/calculator-webapp/calculator-web.svg b/java/sca/contrib/samples/calculator-webapp/calculator-web.svg new file mode 100644 index 0000000000..00ed27556f --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/calculator-web.svg @@ -0,0 +1,358 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + WebApp + + diff --git a/java/sca/contrib/samples/calculator-webapp/pom.xml b/java/sca/contrib/samples/calculator-webapp/pom.xml new file mode 100644 index 0000000000..d2152897dc --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-webapp + war + Apache Tuscany SCA Calculator Sample in a WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..ec57a6a533 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the add service + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e9c635e3c8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ad87375529 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..0f03d6e7a1 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..835e4fda6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..30e4e6a56a --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1a7f145ad8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..57d39cd8d8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,32 @@ + + + + + + + org.apache.tuscany.sca + sample-calculator-webapp + 2.0-SNAPSHOT + war + + + diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..50c23af0b2 --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..b5a828d55b --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Calculator Web Service Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + calc.jsp + + + diff --git a/java/sca/contrib/samples/calculator-webapp/src/main/webapp/calc.jsp b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..4bc5c984dd --- /dev/null +++ b/java/sca/contrib/samples/calculator-webapp/src/main/webapp/calc.jsp @@ -0,0 +1,47 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> + + + + +Calculator sample + + + + + + + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= CalculatorServiceComponent.add(2, 3) %>
3 - 2<%= CalculatorServiceComponent.subtract(3, 2) %>
3 * 2<%= CalculatorServiceComponent.multiply(3, 2) %>
3 / 2<%= CalculatorServiceComponent.divide(3, 2) %>
+ + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/README b/java/sca/contrib/samples/calculator-ws-secure-webapp/README new file mode 100644 index 0000000000..d0d3307b3a --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/README @@ -0,0 +1,116 @@ +Calculator Sample Exposing Secure Web Services In A WebApp +========================================================== +This sample uses the same code as the calculator sample, it deploys the +sample wrapped in a web app and exposes the AddService as a web service. +The autentication intent is applied to communications with the add +component. The integrity intent is applied to communication with the +subtract component. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-calculator-ws-secure-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-secure-webapp + +The sample is configured to use a service on port 8080. If your servlet container +is using a port other than 8080 then you will need to edit the Calculator.composite +and change the uri attribute of the used by the CalculatorServiceComponent +to use the correct port. + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite. + +calculator-webapp/ + src/ + main/ + java/ + calculator/ + AddService.java - As calculator sample + AddServiceImpl.java + CalculatorClient.java - As calculator sample + CalculatorService.java - As calculator sample + CalculatorServiceImpl.java + DivideService.java - As calculator sample + DivideServiceImpl.java + MultiplyService.java - As calculator sample + MultiplyServiceImpl.java + SubtractService.java - As calculator sample + SubtractServiceImpl.java + resources/ + Calculator.composite - As calculator sample except that the + connection between the CalculatorService + and the AddService is web services + definitions.xml - intent and polci set specification + security.properties - security configuration for the + rampart security engine that runs + inside of Axis + calculatorKeys.jks - keystore + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime and maps service + calls to the TuscanyServlet + calc.jsp - the web application that makes use of the + SCA application + + calculator.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + README - this file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd calculator-ws-secure-webapp +ant package + +This should result in a war file (sample-calculator-ws-secure-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in you +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-secure-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see the following output. + +Expression Result +2 + 3 5.0 +3 - 2 1.0 +3 * 2 6.0 +3 / 2 1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-ws-secure-webapp +mvn + +Again this should result in a war file (sample-calculator-ws-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.png b/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.png new file mode 100644 index 0000000000..f482b8d1c8 Binary files /dev/null and b/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.png differ diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.svg b/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.svg new file mode 100644 index 0000000000..1b7015b156 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/calculator-web.svg @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + calc.jsp + + AppServer SOAP local local local + + + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/pom.xml b/java/sca/contrib/samples/calculator-ws-secure-webapp/pom.xml new file mode 100644 index 0000000000..c6d24f4806 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/pom.xml @@ -0,0 +1,102 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-ws-secure-webapp + war + Apache Tuscany SCA Calculator Sample Web Service enabled for +WS Security and in a WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..c7e6383559 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the add service + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..c79c7b0395 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Service; + +/** + * An implementation of the Add service + */ +@Service(AddService.class) +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + System.err.println("********* Adding ***** " + n1 + " to " + n2); + System.err.println("Adding " + n1 + " to " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..4787b728f4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + * + * (not really necessary as this sample runs in a webapp) + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ad87375529 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..0f03d6e7a1 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..835e4fda6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..8f6af2f224 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the subtract service + */ +@Remotable +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1a7f145ad8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java new file mode 100644 index 0000000000..9625c0d692 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ClientPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Client UserId/Password Handler .... "); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + System.out.println("User Id = " + pwcb.getIdentifer()); + System.out.println("Set Password = " + pwcb.getPassword()); + System.out.println("Usage = " + pwcb.getUsage()); + if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) { + if ( pwcb.getIdentifer().equals("CalculatorUser")){ + pwcb.setPassword("CalculatorUserPasswd"); + } else { + throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); + } + } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { + if ( pwcb.getIdentifer().equals("CalculatorUser")) { + pwcb.setPassword("CalculatorUserPasswd"); + } else { + pwcb.setPassword("CalculatorAdmin"); + } + } + } + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java new file mode 100644 index 0000000000..23a62680c5 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ServerPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Server User/Passwd Handler...."); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + System.out.println("User Id = " + pwcb.getIdentifer()); + System.out.println("Password = " + pwcb.getPassword()); + System.out.println("Usage = " + pwcb.getUsage()); + if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) { + if ( pwcb.getIdentifer().equals("CalculatorUser") && + pwcb.getPassword().equals("CalculatorUserPasswd") ){ + return; + } else { + throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); + } + } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { + if ( pwcb.getIdentifer().equals("CalculatorUser")) { + pwcb.setPassword("CalculatorUserPasswd"); + } else { + pwcb.setPassword("CalculatorAdmin"); + } + } + } + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..4d511f887e --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler new file mode 100644 index 0000000000..858e87a34f --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures +# handler classname;qname=;model= +org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://calculator#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy +org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://calculator#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks new file mode 100644 index 0000000000..b6b244244b Binary files /dev/null and b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks differ diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml new file mode 100644 index 0000000000..4611669bbd --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml @@ -0,0 +1,198 @@ + + + + + + + + + + + UsernameToken + calculator.security.ServerPWCBHandler + + + + + + + + + + UsernameToken + CalculatorUser + calculator.security.ClientPWCBHandler" + + PasswordText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CalculatorAdmin + CalculatorAdmin + calculator.security.ServerPWCBHandler + + + + JKS + calculatorKeys.jks + CalculatorAdmin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CalculatorAdmin + CalculatorAdmin + calculator.security.ClientPWCBHandler + + + + JKS + calculatorKeys.jks + CalculatorAdmin + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/security.properties b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/security.properties new file mode 100644 index 0000000000..8ef9928018 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/resources/security.properties @@ -0,0 +1,20 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- +org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin +org.apache.ws.security.crypto.merlin.keystore.type=jks +org.apache.ws.security.crypto.merlin.keystore.password=CalculatorAdmin +org.apache.ws.security.crypto.merlin.file=calculatorKeys.jks diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..fe09ab2e1b --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..d5c02e354d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,33 @@ + + + + + + + org.apache.tuscany.sca + sample-calculator-ws-webapp + 2.0-SNAPSHOT + war + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d3a62d39f4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Calculator Web Service Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + calc.jsp + + + diff --git a/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..4c4366747d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp @@ -0,0 +1,50 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> +<%@ page import="calculator.CalculatorService" %> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); +%> + +Calculator sample + + + + + + + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
+ + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/README b/java/sca/contrib/samples/calculator-ws-webapp/README new file mode 100644 index 0000000000..a6e6c897e4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/README @@ -0,0 +1,108 @@ +Calculator Sample Exposing Web Services In A WebApp +=================================================== +This sample uses the same code as the calculator sample, it deploys the +sample wrapped in a web app and exposes the AddService as a web service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-webapp + +The sample is configured to use a service on port 8080. If your servlet container +is using a port other than 8080 then you will need to edit the Calculator.composite +and change the uri attribute of the used by the CalculatorServiceComponent +to use the correct port. + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite. + +calculator-webapp/ + src/ + main/ + java/ + calculator/ + AddService.java - As calculator sample + AddServiceImpl.java + CalculatorClient.java - As calculator sample + CalculatorService.java - As calculator sample + CalculatorServiceImpl.java + DivideService.java - As calculator sample + DivideServiceImpl.java + MultiplyService.java - As calculator sample + MultiplyServiceImpl.java + SubtractService.java - As calculator sample + SubtractServiceImpl.java + resources/ + Calculator.composite - As calculator sample except that the + connection between the CalculatorService + and the AddService is web services + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime and maps service + calls to the TuscanyServlet + calc.jsp - the web application that makes use of the + SCA application + + calculator.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + README - this file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd calculator-ws-webapp +ant package + +This should result in a war file (sample-calculator-ws-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in you +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see the following output. + +Expression Result +2 + 3 5.0 +3 - 2 1.0 +3 * 2 6.0 +3 / 2 1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-ws-webapp +mvn + +Again this should result in a war file (sample-calculator-ws-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.png b/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.png new file mode 100644 index 0000000000..f482b8d1c8 Binary files /dev/null and b/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.png differ diff --git a/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.svg b/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.svg new file mode 100644 index 0000000000..1b7015b156 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/calculator-web.svg @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + calc.jsp + + AppServer SOAP local local local + + + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/pom.xml b/java/sca/contrib/samples/calculator-ws-webapp/pom.xml new file mode 100644 index 0000000000..e0543d94a8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/pom.xml @@ -0,0 +1,102 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator-ws-webapp + war + Apache Tuscany SCA Calculator Sample Web Service in a WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..c7e6383559 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the add service + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..0af6d681ce --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Service; + +/** + * An implementation of the Add service + */ +@Service(AddService.class) +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + System.err.println("Adding " + n1 + " to " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..4787b728f4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + * + * (not really necessary as this sample runs in a webapp) + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..ad87375529 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..0f03d6e7a1 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..835e4fda6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..8c33862f6d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..db568cc762 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..c7fbc73c00 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..30e4e6a56a --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..1a7f145ad8 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator-ws-webapp/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..6415d5a896 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/resources/Calculator.composite @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..fe09ab2e1b --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..59bbb0de83 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,34 @@ + + + + + + + org.apache.tuscany.sca + sample-calculator-ws-webapp + 2.0-SNAPSHOT + war + + + + + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d3a62d39f4 --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Calculator Web Service Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + calc.jsp + + + diff --git a/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/calc.jsp b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..4c4366747d --- /dev/null +++ b/java/sca/contrib/samples/calculator-ws-webapp/src/main/webapp/calc.jsp @@ -0,0 +1,50 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> +<%@ page import="calculator.CalculatorService" %> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); +%> + +Calculator sample + + + + + + + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
+ + diff --git a/java/sca/contrib/samples/calculator2/README b/java/sca/contrib/samples/calculator2/README new file mode 100644 index 0000000000..ceb532faed --- /dev/null +++ b/java/sca/contrib/samples/calculator2/README @@ -0,0 +1,97 @@ +Calculator Sample +================= +This sample implements a simple calculator using SCA components. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite across the local wires. + +calculator/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component, calls +-/* as + appropriate + CalculatorServiceImpl.java + AddService.java - adds two numbers + AddServiceImpl.java + SubtractService.java - subtracts one number from another + SubtractServiceImpl.java + MultiplyService.java - multiplies two numbers + MultiplyServiceImpl.java + DivideService.java - divides one number by another + DivideServiceImpl.java + CalculatorClient.java - starts the SCA Runtime and + deploys the Calculator.composite. + It then calls the deployed Calculator + Components services + resources/ + Calculator.composite - the SCA assembly for this sample + test/ + java/ + calculator/ + CalculatorTestCase.java - JUnit test case + calculator.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 3 + 2=5.0 + [java] 3 - 2=1.0 + [java] 3 * 2=6.0 + [java] 3 / 2=1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.CalculatorTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/calculator2/build.xml b/java/sca/contrib/samples/calculator2/build.xml new file mode 100644 index 0000000000..c4b755ef94 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator2/calculator.png b/java/sca/contrib/samples/calculator2/calculator.png new file mode 100644 index 0000000000..995a57b1fd Binary files /dev/null and b/java/sca/contrib/samples/calculator2/calculator.png differ diff --git a/java/sca/contrib/samples/calculator2/calculator.svg b/java/sca/contrib/samples/calculator2/calculator.svg new file mode 100644 index 0000000000..0615925c50 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/calculator.svg @@ -0,0 +1,329 @@ + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + diff --git a/java/sca/contrib/samples/calculator2/pom.xml b/java/sca/contrib/samples/calculator2/pom.xml new file mode 100644 index 0000000000..1f95585cbe --- /dev/null +++ b/java/sca/contrib/samples/calculator2/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-calculator2 + Apache Tuscany SCA Calculator Sample + + + + + org.apache.tuscany.sca + tuscany-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-scdl4j + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-runtime2 + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..188451ebac --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The Add service interface + */ +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..7ca8fb04b5 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorClient.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorClient.java new file mode 100644 index 0000000000..9d180bf52e --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorClient.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package calculator; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class CalculatorClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); + + CalculatorService calculatorService = + scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + + // Calculate + System.out.println("3 + 2=" + calculatorService.add(3, 2)); + System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); + System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); + System.out.println("3 / 2=" + calculatorService.divide(3, 2)); + + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..17fad7de6b --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..30d248208b --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The divide service interface + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..1323edf55a --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..91b803bc9e --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..bf0d1882b6 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..58cc4a3547 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + Logger logger = Logger.getLogger("calculator"); + logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/calculator2/src/main/resources/Calculator.composite b/java/sca/contrib/samples/calculator2/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..90872041b0 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/main/resources/Calculator.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java b/java/sca/contrib/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java new file mode 100644 index 0000000000..775ad15537 --- /dev/null +++ b/java/sca/contrib/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CalculatorTestCase extends TestCase { + + private CalculatorService calculatorService; + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("Calculator.composite"); + calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCalculator() throws Exception { + // Calculate + assertEquals(calculatorService.add(3, 2), 5.0); + assertEquals(calculatorService.subtract(3, 2), 1.0); + assertEquals(calculatorService.multiply(3, 2), 6.0); + assertEquals(calculatorService.divide(3, 2), 1.5); + } +} diff --git a/java/sca/contrib/samples/callback-ws-client/README b/java/sca/contrib/samples/callback-ws-client/README new file mode 100644 index 0000000000..66121362c9 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/README @@ -0,0 +1,311 @@ +Callback Web Services Client Sample +=================================== +This sample demonstrates an SCA client that sends service requests to a +remote server and receives asynchronous callbacks from the server, using +Web service bindings for the service and the callback. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look +there first. + +If you just want to run it to see what happens, you need to start the +server first, so open a command prompt and navigate to the +callback-ws-service sample directory and do: + +ant run + +OR if you don't have ant, on Windows do: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer + +and on *nix do: + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-client.jar myapp.MyClientImpl + +and on *nix do: + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-client.jar myapp.MyClientImpl + + +Sample Overview +--------------- +The sample has a single component that has a reference with a service +interface and a callback interface, with Web service bindings for both +these interfaces. The service interface binding URI identifies the +service exposed by the callback-ws-service sample. + +callback-ws-client/ + src/ + main/ + java/ + myapp/ + MyClient.java - interface description for + MyClientComponent + MyClientImpl.java - component implementation + myserver/ + MyService.java - interface description for + MyServiceComponent + MyServiceCallback.java - interface description for callback + resources/ + myapp.composite - the SCA assembly for this sample + test/ + java/ + myapp/ + CallbackClientTestCase.java - JUnit test case + callback-ws-client.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. +Before you do this, run the callback-ws-service sample to start up the +service that the client will talk to. Take a look at the README in +that sample and you will see you need the following commands: + +cd callback-ws-service +ant run + +You can then compile and run this sample using the following commands: + +cd callback-ws-client +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 15-Jan-2008 10:21:38 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl init + [java] INFO: Domain will be started stand-alone as domain URL is not provid +ed + [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.domain.impl.SCADomainImp +l registerNode + [java] INFO: Registered node: http://L3AW203:1336 at endpoint http://L3AW20 +3:1336 + [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl createRuntime + [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea +se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu +bating-SNAPSHOT.jar + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainEventServi +ceProxyComponent + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainAPIService +ProxyComponent + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo +nent/SCANodeManagerService + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo +nent/ComponentManagerService/* + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo +nent/ComponentManagerService + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomain/scaDomain +.js + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl ac +tivateComposite + [java] INFO: Building composite: {http://myapp}myapp + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl st +artComposite + [java] INFO: Starting composite: {http://myapp}myapp + [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1336/MyClientComponent/m +yService + [java] aClientMethod on thread Thread[main,5,main] + [java] aClientMethod return from someMethod on thread Thread[main,5,main] + [java] receiveResult on thread Thread[pool-1-thread-2,5,main] + [java] Result: -> someMethod -> receiveResult + [java] Closing the domain + [java] 15-Jan-2008 10:21:54 org.apache.tuscany.sca.node.impl.SCANodeImpl st +opComposite + [java] INFO: Stopping composite: {http://myapp}myapp + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and +run using Maven as follows. When using Maven you don't need to run the +callback-ws-service sample first as Maven does this for you. With Maven, +both client and server code run in the same JVM, which rather defeats the +purpose of this sample (to show a standalone SCA client), but it's good +enough for a unit test. + +cd callback-ws-client +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running myapp.CallbackClientTestCase +15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init +INFO: Domain will be started stand-alone as domain URL is not provided +15-Jan-2008 10:17:46 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo +de +INFO: Registered node: http://L3AW203:1322 at endpoint http://L3AW203:1322 +15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR +untime +INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw +s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO +T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar +15-Jan-2008 10:17:52 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:17:53 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-1322 +15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-1322 +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainEventServiceProxyCompo +nent +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainAPIServiceProxyCompone +nt +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/SCANode +ManagerService +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone +ntManagerService/* +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone +ntManagerService +15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1322/SCADomain/scaDomain.js +15-Jan-2008 10:17:53 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos +ite +INFO: Building composite: {http://callbackws}callbackws +15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite + +INFO: Starting composite: {http://callbackws}callbackws +15-Jan-2008 10:17:54 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:17:54 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:17:54 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent +15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init +INFO: Domain will be started stand-alone as domain URL is not provided +15-Jan-2008 10:17:54 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo +de +INFO: Registered node: http://L3AW203:1323 at endpoint http://L3AW203:1323 +15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR +untime +INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw +s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO +T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar +15-Jan-2008 10:17:56 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:17:56 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-1323 +15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-1323 +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainEventServiceProxyCompo +nent +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainAPIServiceProxyCompone +nt +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/SCANode +ManagerService +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone +ntManagerService/* +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone +ntManagerService +15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/SCADomain/scaDomain.js +15-Jan-2008 10:17:56 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos +ite +INFO: Building composite: {http://myapp}myapp +15-Jan-2008 10:17:57 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite + +INFO: Starting composite: {http://myapp}myapp +15-Jan-2008 10:17:57 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1323/MyClientComponent/myService +aClientMethod on thread Thread[main,5,main] +aClientMethod return from someMethod on thread Thread[main,5,main] +setMyServiceCallback on thread Thread[pool-1-thread-1,5,main] +someMethod on thread Thread[pool-1-thread-1,5,main] +Sleeping ... +receiveResult on thread Thread[pool-2-thread-1,5,main] +Result: -> someMethod -> receiveResult +Closing the domain +15-Jan-2008 10:18:02 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite +INFO: Stopping composite: {http://myapp}myapp +15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-1323 +15-Jan-2008 10:18:03 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite +INFO: Stopping composite: {http://callbackws}callbackws +15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-1322 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.343 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/callback-ws-client/build.xml b/java/sca/contrib/samples/callback-ws-client/build.xml new file mode 100644 index 0000000000..8698c6018d --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/callback-ws-client/callback-ws-client.png b/java/sca/contrib/samples/callback-ws-client/callback-ws-client.png new file mode 100644 index 0000000000..802ef604a7 Binary files /dev/null and b/java/sca/contrib/samples/callback-ws-client/callback-ws-client.png differ diff --git a/java/sca/contrib/samples/callback-ws-client/callback-ws-client.svg b/java/sca/contrib/samples/callback-ws-client/callback-ws-client.svg new file mode 100644 index 0000000000..f49aeadbbf --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/callback-ws-client.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + myapp + + MyClientComponent + + http://localhost:8086/MyServiceComponent + + myservice callback + + diff --git a/java/sca/contrib/samples/callback-ws-client/pom.xml b/java/sca/contrib/samples/callback-ws-client/pom.xml new file mode 100644 index 0000000000..4ac9e6cf81 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/pom.xml @@ -0,0 +1,86 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-callback-ws-client + Apache Tuscany SCA Callback Web Service Remote Client Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + org.apache.tuscany.sca + sample-callback-ws-service + 2.0-SNAPSHOT + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClient.java b/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClient.java new file mode 100644 index 0000000000..329edbe1c8 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClient.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myapp; + +import org.oasisopen.sca.annotation.OneWay; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java b/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java new file mode 100644 index 0000000000..4f3a3bb63b --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myapp; + +import myserver.MyService; +import myserver.MyServiceCallback; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Remote Web service client with callback interface + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl implements MyClient, MyServiceCallback { + @Reference + protected MyService myService; + + public void aClientMethod() { + System.out.println("aClientMethod on thread " + Thread.currentThread()); + myService.someMethod(" -> someMethod "); // calls the server + System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread()); + } + + public void receiveResult(String result) { + System.out.println("receiveResult on thread " + Thread.currentThread()); + System.out.println("Result: " + result); // callback from the server + } + + public static void main(String[] args) throws Exception { + SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader()); + node.start(); + run(node); + System.out.println("Closing the domain"); + node.stop(); + } + + public static void run(SCANode node) throws InterruptedException { + MyClient myClient = ((SCAClient)node).getService(MyClient.class, "MyClientComponent"); + myClient.aClientMethod(); + Thread.sleep(5000); // don't exit before callback arrives + } +} diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyService.java b/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyService.java new file mode 100644 index 0000000000..9bc056318b --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * The remote service that will be invoked by the client + */ +@Remotable +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java b/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java new file mode 100644 index 0000000000..caef8fcc98 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The callback interface for {@link MyService}. + */ +@Remotable +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..314747d548 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + diff --git a/java/sca/contrib/samples/callback-ws-client/src/main/resources/myapp.composite b/java/sca/contrib/samples/callback-ws-client/src/main/resources/myapp.composite new file mode 100644 index 0000000000..5b776d6df8 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/main/resources/myapp.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java b/java/sca/contrib/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java new file mode 100644 index 0000000000..fb2f6952c4 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myapp; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the callback server is available + */ +public class CallbackClientTestCase { + + private SCANode node; + + @Before + public void startServer() throws Exception { + try { + node = SCANodeFactory.newInstance().createSCANodeFromClassLoader(null, getClass().getClassLoader()); + node.start(); + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } + + @Test + public void testClient() throws Exception { + MyClientImpl.run(node); + } + + @After + public void stopServer() throws Exception { + node.stop(); + } +} diff --git a/java/sca/contrib/samples/callback-ws-service/README b/java/sca/contrib/samples/callback-ws-service/README new file mode 100644 index 0000000000..2c65f745a6 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/README @@ -0,0 +1,227 @@ +Callback Web Services Service Sample +=================================== +This sample demonstrates an SCA service with callback to a remote client +using Web service bindings for the service and the callback. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look +there first. + +If you just want to run it to see what happens open a command prompt, +navigate to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer + +and on *nix do: + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer + +Now the server is started you can use the callback-ws-client sample to +exercise it. + +Sample Overview +--------------- +The sample has a single component that provides a service that is +invoked from a remote client over Web services and makes an SCA callback +over Web services to the same remote client. + +callback-ws-service/ + src/ + main/ + java/ + myserver/ + MyService.java - interface description for + MyServiceComponent + MyServiceCallback.java - interface description for callback + NyServiceImpl.java - component implementation + CallbackServer.java - starts the SCA runtime and + deploys the callbackws.composite + and then waits for the service + to be called via Web services + resources/ + callbackws.composite - the SCA assembly for this sample + test/ + java/ + myserver/ + CallbackServerTestCase.java - JUnit test case + callback-ws-service.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant with +the following commands: + +cd callback-ws-service +ant compile +ant run + +You should see the following output from the run target: + +run: + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl init + [java] INFO: Domain will be started stand-alone as domain URL is not provid +ed + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.domain.impl.SCADomainImp +l registerNode + [java] INFO: Registered node: http://L3AW203:1331 at endpoint http://L3AW20 +3:1331 + [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy +Impl createRuntime + [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea +se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu +bating-SNAPSHOT.jar + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainEventServi +ceProxyComponent + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainAPIService +ProxyComponent + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/SCANodeManagerService + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/ComponentManagerService/* + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo +nent/ComponentManagerService + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomain/scaDomain +.js + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl ac +tivateComposite + [java] INFO: Building composite: {http://callbackws}callbackws + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor + [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl st +artComposite + [java] INFO: Starting composite: {http://callbackws}callbackws + [java] 15-Jan-2008 10:21:26 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] Callback server started (press enter to shutdown) + +As this point the SCA service is exposed as a Web service by a Web server +started automatically by the SCA runtime. To stop the server, press enter. + +To exercise the service, run the callback-ws-client sample. Take a look at +the README in that sample and you will see you need the following commands: + +cd callback-ws-client +ant run + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and +run using Maven as follows. When using Maven you don't need to run the +callback-ws-client sample as the Maven build uses a simple ping test to +make sure that the service is available. + +cd callback-ws-service +mvn + +You should see the following output from the test phase: + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running myserver.CallbackServerTestCase +15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init +INFO: Domain will be started stand-alone as domain URL is not provided +15-Jan-2008 10:29:36 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo +de +INFO: Registered node: http://L3AW203:1365 at endpoint http://L3AW203:1365 +15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR +untime +INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw +s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO +T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar +15-Jan-2008 10:29:42 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:29:42 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-1365 +15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-1365 +15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainEventServiceProxyCompo +nent +15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainAPIServiceProxyCompone +nt +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/SCANode +ManagerService +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone +ntManagerService/* +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone +ntManagerService +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:1365/SCADomain/scaDomain.js +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos +ite +INFO: Building composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite + +INFO: Starting composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +15-Jan-2008 10:29:43 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent +15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite +INFO: Stopping composite: {http://callbackws}callbackws +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8086 +15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-1365 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.422 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/callback-ws-service/build.xml b/java/sca/contrib/samples/callback-ws-service/build.xml new file mode 100644 index 0000000000..c91dd88a8c --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/callback-ws-service/callback-ws-service.png b/java/sca/contrib/samples/callback-ws-service/callback-ws-service.png new file mode 100644 index 0000000000..772ac38431 Binary files /dev/null and b/java/sca/contrib/samples/callback-ws-service/callback-ws-service.png differ diff --git a/java/sca/contrib/samples/callback-ws-service/callback-ws-service.svg b/java/sca/contrib/samples/callback-ws-service/callback-ws-service.svg new file mode 100644 index 0000000000..ff0a1d307b --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/callback-ws-service.svg @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + callbackws + + MyServiceComponent + http://localhost:8086/MyServiceComponent + + myservice callback + + diff --git a/java/sca/contrib/samples/callback-ws-service/pom.xml b/java/sca/contrib/samples/callback-ws-service/pom.xml new file mode 100644 index 0000000000..e39b4480a7 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-callback-ws-service + Apache Tuscany SCA Callback Web Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java new file mode 100644 index 0000000000..75ef05bc48 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +/** + * This server program shows how to create and start an SCA runtime that + * activates the MyService Web service endpoint. + */ +public class CallbackServer { + + public static void main(String[] args) throws Exception { + + SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); + node.start(); + + try { + System.out.println("Callback server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + node.stop(); + System.out.println("Callback server stopped"); + } + +} diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyService.java b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyService.java new file mode 100644 index 0000000000..9bc056318b --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * The remote service that will be invoked by the client + */ +@Remotable +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java new file mode 100644 index 0000000000..caef8fcc98 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The callback interface for {@link MyService}. + */ +@Remotable +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java new file mode 100644 index 0000000000..98833338f0 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + private MyServiceCallback myServiceCallback; + + /** + * The setter used by the runtime to set the callback reference + * @param myServiceCallback + */ + @Callback + public void setMyServiceCallback(MyServiceCallback myServiceCallback) { + System.out.println("setMyServiceCallback on thread " + Thread.currentThread()); + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + System.out.println("someMethod on thread " + Thread.currentThread()); + // invoke the callback + try { + System.out.println("Sleeping ..."); + Thread.sleep(2000); + myServiceCallback.receiveResult(arg + " -> receiveResult "); + } catch(Exception e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..35f7f60c2e --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/java/sca/contrib/samples/callback-ws-service/src/main/resources/callbackws.composite b/java/sca/contrib/samples/callback-ws-service/src/main/resources/callbackws.composite new file mode 100644 index 0000000000..a09e638896 --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/main/resources/callbackws.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/java/sca/contrib/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java new file mode 100644 index 0000000000..e87667cc3e --- /dev/null +++ b/java/sca/contrib/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package myserver; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the callback server is available + */ +public class CallbackServerTestCase { + + private SCANode node; + + @Before + public void startServer() throws Exception { + node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); + node.start(); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8086); + } + + @After + public void stopServer() throws Exception { + node.stop(); + } +} diff --git a/java/sca/contrib/samples/callbacks-jms/README b/java/sca/contrib/samples/callbacks-jms/README new file mode 100644 index 0000000000..b5e130e2fc --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/README @@ -0,0 +1,73 @@ +Callback JMS Sample +=================== +This sample demonstrates SCA callbacks over the JMS binding. It implements the example +described in the INFOQ article: + + "Can I call you back about that?" Building Asynchronous Services using Service Component Architecture + See: http://www.infoq.com/articles/async-sca + +It implements a service for placing an order for some widgets, where the service is asynchronous +and the client is informed of progress via a callback interface. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callbacks-jms.jar callbacks.CallbacksTestCase + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callbacks-jms.jar callbacks.CallbacksTestCase + +Sample Overview +--------------- + +The only changes over the sample code described in the INFOQ article are to add the @Remotable annotation +to the service and callback interfaces, add the @Oneway annotation to the placeOrder and placeOrderResponse +methods, and the composite XML is changed to use instead of . + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd callbacks-jms +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] client placing order: callbacks.OrderRequest@c72243 + [java] service received order: callbacks.OrderRequest@1f94884 + [java] client callback received order response: callbacks.OrderResponse@14ab51b + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd callbacks-jms +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running callbacks.CallbacksTestCase +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/callbacks-jms/build.xml b/java/sca/contrib/samples/callbacks-jms/build.xml new file mode 100644 index 0000000000..665feeca71 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/callbacks-jms/pom.xml b/java/sca/contrib/samples/callbacks-jms/pom.xml new file mode 100644 index 0000000000..d7bef36033 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-callbacks-jms + Apache Tuscany SCA Callbacks with JMS Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + org.apache.activemq + activemq-core + 5.1.0 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java new file mode 100644 index 0000000000..12533ff610 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface OrderCallback { + + @OneWay + public void placeOrderResponse(OrderResponse orderResponse); +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java new file mode 100644 index 0000000000..69f5751379 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +public class OrderRequest { + +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java new file mode 100644 index 0000000000..882bcf8479 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +public class OrderResponse { + +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderService.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderService.java new file mode 100644 index 0000000000..d0161b1498 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(OrderCallback.class) +public interface OrderService { + + @OneWay + public void placeOrder(OrderRequest orderRequest); + +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java new file mode 100644 index 0000000000..757fe3ae41 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +@Service(OrderServiceClient.class) +public class OrderServiceClient implements OrderCallback { + + // A field to hold the reference to the order service + + private OrderService orderService; + public static OrderResponse oResponse; + + public void doSomeOrdering() { + + OrderRequest oRequest = new OrderRequest(); + + // … fill in the details of the order … + + System.out.println("client placing order: " + oRequest); + + orderService.placeOrder(oRequest); + + // …the client code can continue to do processing + } + + public void placeOrderResponse(OrderResponse oResponse) { + + // …handle the response as needed + + System.out.println("client callback received order response: " + oResponse); + OrderServiceClient.oResponse = oResponse; + } + + // A setter method for the order service reference + @Reference + public void setOrderService(OrderService theService) { + orderService = theService; + } +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java new file mode 100644 index 0000000000..9de7307391 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package callbacks; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(OrderService.class) +public class OrderServiceImpl implements OrderService { + + // A field for the callback reference object + private OrderCallback callbackReference; + + // The place order operation itself + public void placeOrder(OrderRequest oRequest) { + + // …do the work to process the order… + // …which may take some time… + + System.out.println("service received order: " + oRequest); + + // when ready to respond… + + OrderResponse theResponse = new OrderResponse(); + + callbackReference.placeOrderResponse(theResponse); + } + + // A setter method for the callback reference + @Callback + public void setCallbackReference(OrderCallback theCallback) { + callbackReference = theCallback; + } +} diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/resources/callbacks.composite b/java/sca/contrib/samples/callbacks-jms/src/main/resources/callbacks.composite new file mode 100644 index 0000000000..94dd29c45d --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/resources/callbacks.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/callbacks-jms/src/main/resources/jndi.properties b/java/sca/contrib/samples/callbacks-jms/src/main/resources/jndi.properties new file mode 100644 index 0000000000..698aeb1711 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/main/resources/jndi.properties @@ -0,0 +1,30 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +# START SNIPPET: jndi + +java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory + +# use the following property to configure the default connector +java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false + +# use the following property to specify the JNDI name the connection factory should appear as. +connectionFactoryNames = ConnectionFactory + +# register some queues in JNDI using the form +# queue.[jndiName] = [physicalName] +queue.OrderService = OrderServiceQueue diff --git a/java/sca/contrib/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java b/java/sca/contrib/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java new file mode 100644 index 0000000000..967fc42c64 --- /dev/null +++ b/java/sca/contrib/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package callbacks; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CallbacksTestCase extends TestCase { + + private OrderServiceClient orderServiceClient; + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("callbacks.composite"); + orderServiceClient = scaDomain.getService(OrderServiceClient.class, "ClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testOderClient() throws Exception { + + orderServiceClient.doSomeOrdering(); + + // wait to give the service time to respond + Thread.sleep(500); + } + + public static void main(String[] args) { + try { + + CallbacksTestCase runner = new CallbacksTestCase(); + runner.setUp(); + runner.testOderClient(); + runner.tearDown(); + + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/chat-webapp/README b/java/sca/contrib/samples/chat-webapp/README new file mode 100644 index 0000000000..09b9c6f6be --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/README @@ -0,0 +1,83 @@ +Chat WebApp Sample +================== +This sample demonstrates the SCA DWR binding to implement the classic Ajax sample +of a chat application which allows multiple users to chat from their browsers. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-chat-webapp.war) +to your web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-chat-webapp + +The port and hostname will of course vary depending on your local installation. + +Sample Overview +--------------- +The sample provides an SCA component which has an SCA service using the SCA DWR +binding and an SCA reference also using the DWR binding. The component implementation +simply forwards every invocation of the service as an invocation on the reference. The +component reference is scoped by the composite so every active client of the composite +will receive every message sent to the component service, thus implementing the chat +application with very little code. + +chat-webapp/ + src/ + main/ + java/ + sample/ + ChatService.java - service interface + ChatServiceImpl.java - service implementation + resources/ + chat.composite - the SCA assembly for this sample + webapp + chat.html - the html UserInterface for this application + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd chat-webapp +ant package + +This should result in a war file (sample-chat-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in you +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-chat-webapp + +The port and hostname will of course vary depending on your local installation. + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd chat-webapp +mvn + +Again this should result in a war file (sample-chat-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/chat-webapp/chat-webapp.png b/java/sca/contrib/samples/chat-webapp/chat-webapp.png new file mode 100644 index 0000000000..fdf540d243 Binary files /dev/null and b/java/sca/contrib/samples/chat-webapp/chat-webapp.png differ diff --git a/java/sca/contrib/samples/chat-webapp/chat-webapp.svg b/java/sca/contrib/samples/chat-webapp/chat-webapp.svg new file mode 100644 index 0000000000..b37c1dc590 --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/chat-webapp.svg @@ -0,0 +1,187 @@ + + + + + + + + + + image/svg+xml + + + + + + + + store + + + DWR + + + DWR + + Catalog + + + diff --git a/java/sca/contrib/samples/chat-webapp/pom.xml b/java/sca/contrib/samples/chat-webapp/pom.xml new file mode 100644 index 0000000000..93fa269cf4 --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/pom.xml @@ -0,0 +1,97 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-chat-webapp + war + Apache Tuscany SCA Chat Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-dwr + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatService.java b/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatService.java new file mode 100644 index 0000000000..bf34675b8a --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatService.java @@ -0,0 +1,26 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package sample; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ChatService { + + public void chat(String msg); + +} diff --git a/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java b/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java new file mode 100644 index 0000000000..f0725dd60c --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ChatServiceImpl implements ChatService { + + ChatService chatters; + + public void chat(String msg) { + chatters.chat(msg); + } + + public void setChatters(ChatService chatters) { + this.chatters = chatters; + } +} diff --git a/java/sca/contrib/samples/chat-webapp/src/main/resources/chat.composite b/java/sca/contrib/samples/chat-webapp/src/main/resources/chat.composite new file mode 100644 index 0000000000..c9ce95e2dc --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/resources/chat.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..897849ff8d --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..97d91fec56 --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + + + Apache Tuscany AJAX/DWR Chat Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + chat.html + + + diff --git a/java/sca/contrib/samples/chat-webapp/src/main/webapp/chat.html b/java/sca/contrib/samples/chat-webapp/src/main/webapp/chat.html new file mode 100644 index 0000000000..7a449a906a --- /dev/null +++ b/java/sca/contrib/samples/chat-webapp/src/main/webapp/chat.html @@ -0,0 +1,70 @@ + + + + Apache Tuscany Ajax/DWR Chat Sample + + + + + + + + +

Apache Tuscany Ajax/DWR Chat Sample

+ + A simple client to chat between multiple web browsers:

+ + Nickname: +

+ + Enter text: + + +

+
+ + + diff --git a/java/sca/contrib/samples/chat2-webapp/README b/java/sca/contrib/samples/chat2-webapp/README new file mode 100644 index 0000000000..0186006211 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/README @@ -0,0 +1,61 @@ +Chat WebApp Sample +================== +This sample demonstrates the SCA DWR binding to implement the classic Ajax sample +of a chat application which allows multiple users to chat from their browsers. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-chat-webapp.war) +to your web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-chat-webapp + +The port and hostname will of course vary depending on your local installation. + +Sample Overview +--------------- +The sample provides an SCA component which has an SCA service using the SCA DWR +binding and an SCA reference also using the DWR binding. The component implementation +simply forwards every invocation of the service as an invocation on the reference. The +component reference is scoped by the composite so every active client of the composite +will receive every message sent to the component service, thus implementing the chat +application with very little code. + +chat-webapp/ + src/ + main/ + java/ + sample/ + ChatService.java - service interface + ChatServiceImpl.java - service implementation + resources/ + chat.composite - the SCA assembly for this sample + webapp + chat.html - the html UserInterface for this application + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + + pom.xml - the Maven build file + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd chat-webapp +mvn + +Again this should result in a war file (sample-chat-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/chat2-webapp/build.xml b/java/sca/contrib/samples/chat2-webapp/build.xml new file mode 100644 index 0000000000..2d3fc0c5f3 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/build.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/chat2-webapp/pom.xml b/java/sca/contrib/samples/chat2-webapp/pom.xml new file mode 100644 index 0000000000..e35891561b --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/pom.xml @@ -0,0 +1,104 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-chat2-webapp + war + Apache Tuscany SCA Chat Sample WebApp using callbacks + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-dwr + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-web + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatCallback.java b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatCallback.java new file mode 100644 index 0000000000..261eb12124 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatCallback.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ChatCallback { + void newMsg(String msg); +} diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatService.java b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatService.java new file mode 100644 index 0000000000..a5aff8f316 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatService.java @@ -0,0 +1,32 @@ +/** + * + * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package sample; + +import javax.jws.Oneway; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Remotable; +import org.oasisopen.sca.annotation.Scope; + +@Remotable +@Scope("COMPOSITE") +@Callback(ChatCallback.class) +public interface ChatService { + + @Oneway + public void addMsg(String msg); +} diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java new file mode 100644 index 0000000000..fd22fb70e8 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.oasisopen.sca.annotation.Callback; + +public class ChatServiceImpl implements ChatService { + + ChatCallback chatCallback; + + @Callback + public void setCallback(ChatCallback chatCallback) { + this.chatCallback = chatCallback; + } + + public void addMsg(String msg) { + chatCallback.newMsg(msg); + } +} diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/resources/chat.composite b/java/sca/contrib/samples/chat2-webapp/src/main/resources/chat.composite new file mode 100644 index 0000000000..93a10d0fdf --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/resources/chat.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..897849ff8d --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..6919372e87 --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,37 @@ + + + + + + Apache Tuscany AJAX/DWR Chat Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + chat.jsp + + + diff --git a/java/sca/contrib/samples/chat2-webapp/src/main/webapp/chat.html b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/chat.html new file mode 100644 index 0000000000..a063e27f8e --- /dev/null +++ b/java/sca/contrib/samples/chat2-webapp/src/main/webapp/chat.html @@ -0,0 +1,73 @@ + + + + Apache Tuscany Ajax/DWR Chat Sample + + + + + + +

Apache Tuscany Ajax/DWR Chat Sample

+ + A simple client to chat between multiple web browsers:

+ + Nickname: +

+ + Enter text: + + +

+
+ + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/README b/java/sca/contrib/samples/customer-dojo-webapp/README new file mode 100644 index 0000000000..9c1729123f --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/README @@ -0,0 +1,104 @@ +Customer Dojo RPC Sample +=========================== + +Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 + +This sample demostrates the SCA JSONRPC binding using a simple web app that +uses the RPC support of the Dojo Toolkit to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding +but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be +used to invoke the SCA service. + +The web app provided shows how the service can be called by using the DOJO toolkit. + +helloworld-dojo-webapp/ + build-dojo.xml - This file is an Ant script used by the + sample build process to download the Dojo Toolkit + and get it included in the WAR file + for use by the sample. + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + dojo/ - the Dojo toolkit (this directory is created only + when you build the samples from the source distribution) + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-dojo-webapp +ant package + +This should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-dojo-webapp +mvn + +Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/build-dojo.xml b/java/sca/contrib/samples/customer-dojo-webapp/build-dojo.xml new file mode 100644 index 0000000000..534a1dacd9 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/build.xml b/java/sca/contrib/samples/customer-dojo-webapp/build.xml new file mode 100644 index 0000000000..95813af65a --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/build.xml @@ -0,0 +1,70 @@ + + +]> + + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png b/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png differ diff --git a/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg b/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg new file mode 100644 index 0000000000..d5c3bc5d3e --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/customer.sql b/java/sca/contrib/samples/customer-dojo-webapp/customer.sql new file mode 100644 index 0000000000..a3caf8e050 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/customer.sql @@ -0,0 +1,33 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. +-- + +DROP TABLE CUSTOMER; + +CREATE TABLE CUSTOMER ( + ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, + NAME VARCHAR(30), + PHONE VARCHAR(10), + ADDRESS VARCHAR(25), + CITY VARCHAR(15), + STATE VARCHAR(2), + ZIP VARCHAR(5)); + +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Joe Smith', '4081234567', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Erik Johnson', '4081230987', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Mark Pensacola', '4085679988', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo-webapp/pom.xml b/java/sca/contrib/samples/customer-dojo-webapp/pom.xml new file mode 100644 index 0000000000..2474a561fb --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/pom.xml @@ -0,0 +1,232 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-customer-dojo-webapp + war + Apache Tuscany SCA Customer DOJO Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.geronimo.specs + geronimo-jpa_3.0_spec + 1.1 + + + + org.apache.openjpa + openjpa + 1.0.0 + + + javax.xml.bind + jaxb-api + + + + + + org.apache.derby + derby + 10.3.1.4 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + true + + + generate + + + + + + org.codehaus.mojo + sql-maven-plugin + 1.3 + + + + org.apache.derby + derby + 10.3.1.4 + + + + + + create-db + generate-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;create=true + true + continue + skip + ; + + ${pom.basedir}/customer.sql + + + + + + + shutdown-database-sothat-test-can-run + process-test-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;shutdown=true + true + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/Customer.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/Customer.java new file mode 100644 index 0000000000..6d207ea2ef --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/Customer.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import javax.persistence.Basic; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Customer { + + @Id protected int id; + @Basic protected String name; + @Basic protected String phone; + @Basic protected String address; + @Basic protected String city; + @Basic protected String state; + @Basic protected String zip; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java new file mode 100644 index 0000000000..5ad39aad5c --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package customer; + +import org.apache.tuscany.sca.data.collection.Collection; + + +public interface CustomerCollection extends Collection { + +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java new file mode 100644 index 0000000000..c0a2f25f15 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package customer; + +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; + + +public class CustomerCollectionImpl implements CustomerCollection { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerCollectionImpl() { + System.out.println(">>>"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void delete(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Customer get(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + return null; + } + + public Entry[] getAll() { + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + + System.out.println(customer); + } + + tx.commit(); + } catch(Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return null; + } + + public String post(String arg0, Customer arg1) { + // TODO Auto-generated method stub + return null; + } + + public void put(String arg0, Customer arg1) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Entry[] query(String arg0) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java new file mode 100644 index 0000000000..b3c965f1f7 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CustomerService { + + Customer[] get(); + + Customer findCustomerByName(String name); + +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java new file mode 100644 index 0000000000..2bd49e2cf1 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Init; + +public class CustomerServiceImpl implements CustomerService { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerServiceImpl() { + + } + + @Init + public void init() { + System.out.println(">>> Initializing JPA"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Destroy + public void destroy() { + emf.close(); + } + + public Customer[] get() { + EntityTransaction tx = em.getTransaction(); + List customers = new ArrayList(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + customers.add(customer); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + Customer[] customerArray = new Customer[customers.size()]; + customers.toArray(customerArray); + return customerArray; + } + + public Customer findCustomerByName(String name) { + EntityTransaction tx = em.getTransaction(); + Customer customer = null; + + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c WHERE c.name = '" + name + "'"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + customer = (Customer)iter.next(); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return customer; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/launch/Launch.java b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/launch/Launch.java new file mode 100644 index 0000000000..d7f88b8dd4 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/java/launch/Launch.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class Launch { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("customer.composite"); + System.out.println("store.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml new file mode 100644 index 0000000000..64be295302 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..5674dede06 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,40 @@ + + + + + + + orm.xml + customer.Customer + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..136326d1d3 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/customer.composite b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/customer.composite new file mode 100644 index 0000000000..8b8a413499 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/resources/customer.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..32f11ab9d0 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..3e72bf29a4 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,34 @@ + + + + + + + org.apache.tuscany.sca + sample-customer-dojo-webapp + 2.0-SNAPSHOT + war + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d90b4a7d62 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Customer dojo web application sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + customer.jsp + + + diff --git a/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/customer.jsp b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/customer.jsp new file mode 100644 index 0000000000..f7e864053e --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo-webapp/src/main/webapp/customer.jsp @@ -0,0 +1,80 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + Tuscany Dojo JSON-RPC Customer Example + + + + + + + + + + + + + + + +

Tuscany Dojo JSON-RPC Customer Sample

+ +Customer Name :
+ + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/README b/java/sca/contrib/samples/customer-dojo/README new file mode 100644 index 0000000000..9c1729123f --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/README @@ -0,0 +1,104 @@ +Customer Dojo RPC Sample +=========================== + +Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 + +This sample demostrates the SCA JSONRPC binding using a simple web app that +uses the RPC support of the Dojo Toolkit to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding +but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be +used to invoke the SCA service. + +The web app provided shows how the service can be called by using the DOJO toolkit. + +helloworld-dojo-webapp/ + build-dojo.xml - This file is an Ant script used by the + sample build process to download the Dojo Toolkit + and get it included in the WAR file + for use by the sample. + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + dojo/ - the Dojo toolkit (this directory is created only + when you build the samples from the source distribution) + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-dojo-webapp +ant package + +This should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-dojo-webapp +mvn + +Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/customer-dojo/build-dojo.xml b/java/sca/contrib/samples/customer-dojo/build-dojo.xml new file mode 100644 index 0000000000..8c6bd99484 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/build.xml b/java/sca/contrib/samples/customer-dojo/build.xml new file mode 100644 index 0000000000..95813af65a --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/build.xml @@ -0,0 +1,70 @@ + + +]> + + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.png b/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.png differ diff --git a/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.svg b/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.svg new file mode 100644 index 0000000000..d5c3bc5d3e --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/customer-dojo-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/java/sca/contrib/samples/customer-dojo/customer.sql b/java/sca/contrib/samples/customer-dojo/customer.sql new file mode 100644 index 0000000000..a3caf8e050 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/customer.sql @@ -0,0 +1,33 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. +-- + +DROP TABLE CUSTOMER; + +CREATE TABLE CUSTOMER ( + ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, + NAME VARCHAR(30), + PHONE VARCHAR(10), + ADDRESS VARCHAR(25), + CITY VARCHAR(15), + STATE VARCHAR(2), + ZIP VARCHAR(5)); + +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Joe Smith', '4081234567', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Erik Johnson', '4081230987', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Mark Pensacola', '4085679988', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo/pom.xml b/java/sca/contrib/samples/customer-dojo/pom.xml new file mode 100644 index 0000000000..5c64caaad4 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/pom.xml @@ -0,0 +1,244 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-customer-dojo + Apache Tuscany SCA Customer DOJO Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + + + + org.apache.geronimo.specs + geronimo-jpa_3.0_spec + 1.1 + + + + org.apache.openjpa + openjpa + 1.0.0 + + + javax.xml.bind + jaxb-api + + + + + + org.apache.derby + derby + 10.3.1.4 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + true + + + generate + + + + + + org.codehaus.mojo + sql-maven-plugin + 1.3 + + + + org.apache.derby + derby + 10.3.1.4 + + + + + + create-db + generate-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;create=true + true + continue + skip + ; + + ${pom.basedir}/customer.sql + + + + + + + shutdown-database-sothat-test-can-run + process-test-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;shutdown=true + true + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/customer/Customer.java b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/Customer.java new file mode 100644 index 0000000000..6d207ea2ef --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/Customer.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import javax.persistence.Basic; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Customer { + + @Id protected int id; + @Basic protected String name; + @Basic protected String phone; + @Basic protected String address; + @Basic protected String city; + @Basic protected String state; + @Basic protected String zip; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollection.java b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollection.java new file mode 100644 index 0000000000..5ad39aad5c --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollection.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package customer; + +import org.apache.tuscany.sca.data.collection.Collection; + + +public interface CustomerCollection extends Collection { + +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java new file mode 100644 index 0000000000..c0a2f25f15 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package customer; + +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; + + +public class CustomerCollectionImpl implements CustomerCollection { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerCollectionImpl() { + System.out.println(">>>"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void delete(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Customer get(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + return null; + } + + public Entry[] getAll() { + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + + System.out.println(customer); + } + + tx.commit(); + } catch(Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return null; + } + + public String post(String arg0, Customer arg1) { + // TODO Auto-generated method stub + return null; + } + + public void put(String arg0, Customer arg1) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Entry[] query(String arg0) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerService.java b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerService.java new file mode 100644 index 0000000000..b3c965f1f7 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CustomerService { + + Customer[] get(); + + Customer findCustomerByName(String name); + +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java new file mode 100644 index 0000000000..2bd49e2cf1 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package customer; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.oasisopen.sca.annotation.Destroy; +import org.oasisopen.sca.annotation.Init; + +public class CustomerServiceImpl implements CustomerService { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerServiceImpl() { + + } + + @Init + public void init() { + System.out.println(">>> Initializing JPA"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Destroy + public void destroy() { + emf.close(); + } + + public Customer[] get() { + EntityTransaction tx = em.getTransaction(); + List customers = new ArrayList(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + customers.add(customer); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + Customer[] customerArray = new Customer[customers.size()]; + customers.toArray(customerArray); + return customerArray; + } + + public Customer findCustomerByName(String name) { + EntityTransaction tx = em.getTransaction(); + Customer customer = null; + + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c WHERE c.name = '" + name + "'"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + customer = (Customer)iter.next(); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return customer; + } + +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/java/launch/Launch.java b/java/sca/contrib/samples/customer-dojo/src/main/java/launch/Launch.java new file mode 100644 index 0000000000..a51ab605bc --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/java/launch/Launch.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class Launch { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("customer.composite"); + System.out.println("customer.composite ready for big business !!!"); + System.out.println("url : http://localhost:8080/customer.html"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/orm.xml b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/orm.xml new file mode 100644 index 0000000000..64be295302 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/orm.xml @@ -0,0 +1,51 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/persistence.xml b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..5add897279 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,40 @@ + + + + + + + orm.xml + customer.Customer + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..136326d1d3 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/src/main/resources/content/customer.html b/java/sca/contrib/samples/customer-dojo/src/main/resources/content/customer.html new file mode 100644 index 0000000000..dbc8aad9d0 --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/resources/content/customer.html @@ -0,0 +1,77 @@ + + + + Tuscany Dojo JSON-RPC Customer Example + + + + + + + + + + + + + + + +

Tuscany Dojo JSON-RPC Customer Sample

+ +Customer Name :
+ + + + + + + + diff --git a/java/sca/contrib/samples/customer-dojo/src/main/resources/customer.composite b/java/sca/contrib/samples/customer-dojo/src/main/resources/customer.composite new file mode 100644 index 0000000000..4c370f2a9f --- /dev/null +++ b/java/sca/contrib/samples/customer-dojo/src/main/resources/customer.composite @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/databinding-echo/README b/java/sca/contrib/samples/databinding-echo/README new file mode 100644 index 0000000000..67c1aa32d5 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/README @@ -0,0 +1,143 @@ +DataBinding Echo Sample +======================= + +This sample demonstrates how databindings are used to convert data formats as +the data flows between components. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens, open a command prompt, navigate +to this sample directory, and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-databinding-echo.jar dbecho.EchoDataBindingClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-databinding-echo.jar dbecho.EchoDataBindingClient + + +Sample Overview +--------------- +If reference and service interfaces are the same in all but the formats of +data being passed to and returned from the operations of the interfaces, +then SCA will try to apply appropriate transformations to the data formats +to allow messages to pass. + +This sample shows this happening. ComponentA implements Interface1 which +defines; + + String call(String msg) + String call1(String msg) + +ComponentA defines a reference to ComponentB with Interface1. ComponentB +however implements Interface2 which defines; + + Node call(Node msg); + XMLStreamReader call1(XMLStreamReader msg); + +You can see from the test output below that SCA converts the call() msg from a +String to a DOM object (org.apache.xerces.dom.DeferredDocumentImpl). It +converts the call1() msg from a String to a XML stream reader +(com.ctc.wstx.sr.ValidatingStreamReader). + +databinding-echo/ + src/ + main/ + java/ + dbecho/ + ComponentAImpl.java - component implementation + ComponentBImpl.java - component implementation + Echo.java - service interface with data binding + EchoDataBindingClient.java - sample client code + Interface1.java - service interface with data binding + Interface2.java - service interface with data bindings + resources/ + META-INF/ + services/ + org.apache.tuscany.sca.core.ModuleActivator - specifies the module activation class to call + EchoDataBinding.composite - composite definition + wsdl/ + echo.wsdl - WSDL deinitions + test/ + java/ + dbecho/ + EchoDataBindingTestCase.java - junit test case + databinding-echo.png - pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +TODO - Needs more description of what else is going on in this test + properties, wsdl? + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows. + +cd databinding-echo +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] [Property] prefix: ABC + [java] [Property] prefix1: ABC + [java] [Property] bar: BAR + [java] ComponentA --> Received message: 123 [java.lang.String] + [java] ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] + [java] ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] + [java] ComponentA --> Returned message: 123 [java.lang.String] + [java] [Property] prefix: ABC + [java] [Property] prefix1: ABC + [java] [Property] bar: BAR + [java] ComponentA --> Received message: 123 [java.lang.String] + [java] ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader] + [java] ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader] + [java] ComponentA --> Returned message: 123 [java.lang.String] + [java] call response = 123 + [java] call1 response = 123 + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd databinding-echo +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running dbecho.EchoDataBindingTestCase +[Property] prefix: ABC +[Property] prefix1: ABC +[Property] bar: BAR +ComponentA --> Received message: 123 [java.lang.String] +ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] +ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] +ComponentA --> Returned message: 123 [java.lang.String] +[Property] prefix: ABC +[Property] prefix1: ABC +[Property] bar: BAR +ComponentA --> Received message: 123 [java.lang.String] +ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader] +ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader] +ComponentA --> Returned message: 123 [java.lang.String] +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.653 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/databinding-echo/build.xml b/java/sca/contrib/samples/databinding-echo/build.xml new file mode 100644 index 0000000000..7f2483f6fb --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/databinding-echo/databinding-echo.png b/java/sca/contrib/samples/databinding-echo/databinding-echo.png new file mode 100644 index 0000000000..afbbfff285 Binary files /dev/null and b/java/sca/contrib/samples/databinding-echo/databinding-echo.png differ diff --git a/java/sca/contrib/samples/databinding-echo/databinding-echo.svg b/java/sca/contrib/samples/databinding-echo/databinding-echo.svg new file mode 100644 index 0000000000..87964abf86 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/databinding-echo.svg @@ -0,0 +1,408 @@ + + + + + + + + + + image/svg+xml + + + + + + + + EchoDataBinding + ComponentB + + + + + + ComponentA + + + prefixprefix1bar Interface1 Interface2 EchoReferencebinding.echo + + + messagePrefix complexProperty + @DataBinding("org.w3c.dom.Node")&@DataBinding("javax.xml.stream.XMLStreamReader") @DataBinding("java.lang.String") + + <db:databinding name="org.apache.axiom.om.OMElement" /> + Interface1 + Echo @DataBinding("org.w3c.dom.Node") + @DataBinding("java.lang.String") + + diff --git a/java/sca/contrib/samples/databinding-echo/pom.xml b/java/sca/contrib/samples/databinding-echo/pom.xml new file mode 100644 index 0000000000..3010c7e89e --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + + sample-databinding-echo + Apache Tuscany SCA Echo Data Binding Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-databinding + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + sample-binding-echo + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface-wsdl-xml + 2.0-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java new file mode 100644 index 0000000000..29a5e5c9ad --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +/** + * @version $Rev$ $Date$ + */ +public class ComponentAImpl implements Interface1 { + + private Interface1 componentBReference; + + @Constructor + public ComponentAImpl(@Reference(name = "componentBReference", required = true) + Interface1 componentBReference) { + this.componentBReference = componentBReference; + } + + public String call(String msg) { + String request = msg + " [" + msg.getClass().getName() + "]"; + System.out.println("ComponentA --> Received message: " + request); + Object ret = componentBReference.call(msg); + String response = ret + " [" + ret.getClass().getName() + "]"; + System.out.println("ComponentA --> Returned message: " + response); + return (String) ret; + } + + public String call1(String msg) { + String request = msg + " [" + msg.getClass().getName() + "]"; + System.out.println("ComponentA --> Received message: " + request); + Object ret = componentBReference.call1(msg); + String response = ret + " [" + ret.getClass().getName() + "]"; + System.out.println("ComponentA --> Returned message: " + response); + return (String) ret; + } + + @Property(name="prefix") + public void setPrefix(String prefix) { + System.out.println("[Property] prefix: " + prefix); + } + + @Property(name="prefix1") + public void setPrefix1(String prefix1) { + System.out.println("[Property] prefix1: " + prefix1); + } + + /** + * @param bar the bar to set + */ + @Property(name="bar") + public void setBar(String bar) { + System.out.println("[Property] bar: " + bar); + } + +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java new file mode 100644 index 0000000000..e98cd55bcf --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import javax.xml.stream.XMLStreamReader; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Constructor; +import org.oasisopen.sca.annotation.Reference; +import org.w3c.dom.Node; + +/** + * @version $Rev$ $Date$ + */ +@AllowsPassByReference +public class ComponentBImpl implements Interface2 { + + private Echo echoReference; + + @Constructor + public ComponentBImpl(@Reference(name = "echoReference", required = true) + Echo echoReference) { + this.echoReference = echoReference; + } + + public Node call(Node msg) { + String request = msg + " [" + msg.getClass().getName() + "]"; + System.out.println("ComponentB --> Received message: " + request); + Node ret = (Node) echoReference.echo(msg); + String response = ret + " [" + ret.getClass().getName() + "]"; + System.out.println("ComponentB --> Returned message: " + response); + return ret; + } + + public XMLStreamReader call1(XMLStreamReader msg) { + String request = msg + " [" + msg.getClass().getName() + "]"; + System.out.println("ComponentB --> Received message: " + request); +// XMLStreamReader ret = (XMLStreamReader) echoReference.echo(msg); + String response = request; + System.out.println("ComponentB --> Returned message: " + response); + return msg; + } +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Echo.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Echo.java new file mode 100644 index 0000000000..b47a9c1b85 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Echo.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import org.apache.tuscany.sca.databinding.annotation.DataBinding; +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ + +@DataBinding("org.w3c.dom.Node") +@Remotable +public interface Echo { + Object echo(Object msg); +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java new file mode 100644 index 0000000000..9ec3819899 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + * @version $Rev$ $Date$ + */ +public class EchoDataBindingClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("EchoDataBinding.composite"); + + Interface1 componentA = scaDomain.getService(Interface1.class, "ComponentA"); + String response = componentA.call("123"); + String response1= componentA.call1("123"); + + + System.out.println("call response = " + response ); + System.out.println("call1 response = " + response1 ); + + scaDomain.close(); + + } + +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface1.java new file mode 100644 index 0000000000..9fff3bb4b9 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface1.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import org.apache.tuscany.sca.databinding.annotation.DataBinding; +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@DataBinding("java.lang.String") +@Remotable +public interface Interface1 { + String call(String msg); + String call1(String msg); +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface2.java new file mode 100644 index 0000000000..61ed7951e4 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/java/dbecho/Interface2.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import javax.xml.stream.XMLStreamReader; + +import org.apache.tuscany.sca.databinding.annotation.DataBinding; +import org.oasisopen.sca.annotation.Remotable; +import org.w3c.dom.Node; + +/** + * @version $Rev$ $Date$ + */ +@DataBinding("org.w3c.dom.Node") +@Remotable +public interface Interface2 { + Node call(Node msg); + @DataBinding("javax.xml.stream.XMLStreamReader") + XMLStreamReader call1(XMLStreamReader msg); +} diff --git a/java/sca/contrib/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/java/sca/contrib/samples/databinding-echo/src/main/resources/EchoDataBinding.composite new file mode 100644 index 0000000000..30b77a6152 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/resources/EchoDataBinding.composite @@ -0,0 +1,58 @@ + + + + + + + + ABC + + + + + + + + + + + + + + + ABC + + + BAR + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/java/sca/contrib/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl new file mode 100644 index 0000000000..ef2308aa73 --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/java/sca/contrib/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java new file mode 100644 index 0000000000..43434d8cee --- /dev/null +++ b/java/sca/contrib/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package dbecho; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * @version $Rev$ $Date$ + */ +public class EchoDataBindingTestCase extends TestCase { + + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("EchoDataBinding.composite"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + protected Interface1 componentA; + + public void testTransform() { + componentA = scaDomain.getService(Interface1.class, "ComponentA"); + componentA.call("123"); + componentA.call1("123"); + } +} diff --git a/java/sca/contrib/samples/domain-management/README b/java/sca/contrib/samples/domain-management/README new file mode 100644 index 0000000000..6280a28028 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/README @@ -0,0 +1,8 @@ +Domain Management Sample Tasks +============================== +This sample implements the following sample domain management tasks: +- list deployables in a contribution +- list contribution dependencies +- fuse includes in a composite +- add deployables to a domain composite and wire them + diff --git a/java/sca/contrib/samples/domain-management/pom.xml b/java/sca/contrib/samples/domain-management/pom.xml new file mode 100644 index 0000000000..a64e411922 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/pom.xml @@ -0,0 +1,247 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-domain-management + Apache Tuscany SCA Sample Domain Management Tasks + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-assembly + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-contribution + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-contribution-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-workspace + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-workspace-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-workspace-impl + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-node + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-extensibility + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-monitor + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-monitor-logging + 2.0-SNAPSHOT + runtime + + + + xerces + xercesImpl + 2.8.1 + + + + org.apache.tuscany.sca + tuscany-binding-atom + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-contribution-java + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-contribution-namespace + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-contribution-resource + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-implementation-java-xml + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-interface-java-xml + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + assets + package + + single + + + + src/test/resources/assembly/assets.xml + + gnu + ${artifactId} + + + + store + package + + single + + + + src/test/resources/assembly/store.xml + + gnu + ${artifactId} + + + + client + package + + single + + + + src/test/resources/assembly/client.xml + + gnu + ${artifactId} + + + + + + + diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java new file mode 100644 index 0000000000..28eede693d --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java @@ -0,0 +1,328 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.transform.TransformerFactory; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.SCABindingFactory; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; +import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.ModuleActivator; +import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.implementation.node.NodeImplementation; +import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; +import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; +import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.launcher.NodeLauncher; +import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +/** + * Sample RunComponents task + * + * Under construction... This sample is similar to the DistributeComponents sample, + * with extra steps to configure SCA runtime nodes with the models, start and stop + * them. + * + * @version $Rev$ $Date$ + */ +public class DistributeAndRunComponents { + + private static URLArtifactProcessor contributionProcessor; + private static ModelResolverExtensionPoint modelResolvers; + private static ModelFactoryExtensionPoint modelFactories; + private static WorkspaceFactory workspaceFactory; + private static AssemblyFactory assemblyFactory; + private static XMLOutputFactory outputFactory; + private static DocumentBuilderFactory documentBuilderFactory; + private static TransformerFactory transformerFactory; + private static StAXArtifactProcessor xmlProcessor; + private static ContributionDependencyBuilder contributionDependencyBuilder; + private static CompositeBuilder domainCompositeBuilder; + private static CompositeBuilder nodeCompositeBuilder; + private static NodeImplementationFactory nodeFactory; + private static AtomBindingFactory atomBindingFactory; + + private static void init() { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Create a monitor + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + + // Initialize the Tuscany module activators + ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); + for (ModuleActivator activator: moduleActivators.getModuleActivators()) { + activator.start(extensionPoints); + } + + // Get XML input/output factories + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); + transformerFactory = modelFactories.getFactory(TransformerFactory.class); + + // Get contribution workspace and assembly model factories + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class); + atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class); + + // Create XML artifact processors + StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); + + // Create contribution content processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Get the model resolvers + modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + + // Create a composite builder + SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); + IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); + InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); + domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, + documentBuilderFactory, transformerFactory, contractMapper, monitor); + + // Create a node composite builder + nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, + documentBuilderFactory, transformerFactory, contractMapper, null, monitor); + } + + + public static void main(String[] args) throws Exception { + init(); + + // Create workspace model + Workspace workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI storeURI = URI.create("store"); + URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); + workspace.getContributions().add(storeContribution); + + // Read the sample assets contribution + URI assetsURI = URI.create("assets"); + URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); + Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); + workspace.getContributions().add(assetsContribution); + + // Read the sample client contribution + URI clientURI = URI.create("client"); + URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); + Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); + workspace.getContributions().add(clientContribution); + + // Build the contribution dependencies + Map> contributionDependencies = new HashMap>(); + Set resolved = new HashSet(); + for (Contribution contribution: workspace.getContributions()) { + List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + + // Resolve contributions + for (Contribution dependency: dependencies) { + if (!resolved.contains(dependency)) { + resolved.add(dependency); + contributionProcessor.resolve(dependency, workspace.getModelResolver()); + } + } + + contributionDependencies.put(contribution, dependencies); + } + + // Create a set of nodes, and assign the sample deployables to them + Map> nodeDependencies = new HashMap>(); + Composite cloudComposite = assemblyFactory.createComposite(); + cloudComposite.setName(new QName("http://sample", "cloud")); + int nodeID = 8100; + for (Contribution contribution: workspace.getContributions()) { + for (Composite deployable: contribution.getDeployables()) { + + // Create a node + Component node = assemblyFactory.createComponent(); + node.setName("Node" + nodeID); + cloudComposite.getComponents().add(node); + + // Add default binding configuration to the node, our samples use + // Atom bindings so here we're just creating default Atom binding + // configurations, but all the other binding types can be configured + // like that too + ComponentService nodeService = assemblyFactory.createComponentService(); + Binding binding = atomBindingFactory.createAtomBinding(); + binding.setURI("http://localhost:" + (8100 + nodeID)); + nodeService.getBindings().add(binding); + node.getServices().add(nodeService); + + // Assign a deployable to the node + NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation(); + nodeImplementation.setComposite(deployable); + node.setImplementation(nodeImplementation); + + // Keep track of what contributions will be needed by the node + nodeDependencies.put(node, contributionDependencies.get(contribution)); + + nodeID++; + } + } + + // Print the model describing the nodes that we just built + System.out.println("cloud.composite"); + System.out.println(print(cloudComposite)); + + // Build the nodes, this will apply their default binding configuration to the + // composites assigned to them + nodeCompositeBuilder.build(cloudComposite); + + // Create a composite model for the domain + Composite domainComposite = assemblyFactory.createComposite(); + domainComposite.setName(new QName("http://sample", "domain")); + + // Add all deployables to it, normally the domain administrator would select + // the deployables to include + domainComposite.getIncludes().addAll(workspace.getDeployables()); + + // Build the domain composite and wire the components included in it + domainCompositeBuilder.build(domainComposite); + + // Print out the resulting domain composite + System.out.println("domain.composite"); + System.out.println(print(domainComposite)); + + // Now start our SCA nodes + List runtimeNodes = new ArrayList(); + NodeLauncher launcher = NodeLauncher.newInstance(); + for (Component node: cloudComposite.getComponents()) { + + // Create a composite containing the components that we want to run + // on the node + Composite runnable = assemblyFactory.createComposite(); + runnable.setName(new QName("http://sample", node.getName())); + NodeImplementation nodeImplementation = (NodeImplementation)node.getImplementation(); + for (Component component: nodeImplementation.getComposite().getComponents()) { + for (Component configured: domainComposite.getComponents()) { + if (configured.getName().equals(component.getName())) { + runnable.getComponents().add(configured); + break; + } + } + } + + // Create the SCA node, give it the composite and the list of contributions + // to use + List dependencies = nodeDependencies.get(node); + org.apache.tuscany.sca.node.launcher.Contribution[] contributions = new org.apache.tuscany.sca.node.launcher.Contribution[dependencies.size()]; + for (int c =0, n = dependencies.size(); c < n; c++) { + Contribution dependency = dependencies.get(c); + contributions[c] = new org.apache.tuscany.sca.node.launcher.Contribution(dependency.getURI(), dependency.getLocation()); + } + SCANode runtimeNode = launcher.createNode("http://sample/" + node.getName(), print(runnable), contributions); + + // Start the node + runtimeNode.start(); + runtimeNodes.add(runtimeNode); + } + + System.out.println("Nodes are running, press enter to stop..."); + System.in.read(); + + for (SCANode runtimeNode: runtimeNodes) { + runtimeNode.stop(); + } + } + + private static String print(Composite composite) throws XMLStreamException, ContributionWriteException, ParserConfigurationException, SAXException, IOException { + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + xmlProcessor.write(composite, writer); + + // Parse and write again to pretty format it + DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setIndent(2); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + XMLSerializer serializer = new XMLSerializer(out, format); + serializer.serialize(document); + return out.toString(); + } +} diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeComponents.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeComponents.java new file mode 100644 index 0000000000..def0a1894f --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/DistributeComponents.java @@ -0,0 +1,288 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URL; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.transform.TransformerFactory; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.SCABindingFactory; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; +import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ContributionFactory; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.ModuleActivator; +import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.implementation.node.NodeImplementation; +import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; +import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; +import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; +import org.apache.tuscany.sca.policy.PolicyFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +/** + * Sample DistributeComponents task + * + * This sample shows how to use a subset of Tuscany to read contribution + * metadata, analyze and resolve contribution dependencies, read and resolve + * the artifacts that they contribute (in particular implementation artifacts, + * interfaces, composites, componentTypes etc.) and assembe and wire the + * deployable composites together in a composite model representing an SCA + * domain composite. + * + * The difference between this sample and the WireComponents sample is an + * extra step to allocate deployable composites to SCA nodes. SCA nodes allow + * you to provide default configuration for the deploayable composites allocated + * to them, for example default binding configuration. + * + * The sample first reads the SCA metadata for three sample contributions, + * reads and resolve the artifacts contained in the contributions, includes all their + * deployable composites in a composite model representing an SCA domain, then + * uses several composite builder utilities to configure them as specified in the + * SCA nodes hosting them and assemble and wire them together. + * Finally it prints the resulting domain composite model, showing service bindings + * configured with the URIs from the nodes hosting them. + * + * @version $Rev$ $Date$ + */ +public class DistributeComponents { + + private static URLArtifactProcessor contributionProcessor; + private static ModelResolverExtensionPoint modelResolvers; + private static ModelFactoryExtensionPoint modelFactories; + private static WorkspaceFactory workspaceFactory; + private static AssemblyFactory assemblyFactory; + private static XMLOutputFactory outputFactory; + private static DocumentBuilderFactory documentBuilderFactory; + private static TransformerFactory transformerFactory; + private static StAXArtifactProcessor xmlProcessor; + private static ContributionDependencyBuilder contributionDependencyBuilder; + private static CompositeBuilder domainCompositeBuilder; + private static CompositeBuilder nodeCompositeBuilder; + private static NodeImplementationFactory nodeFactory; + private static AtomBindingFactory atomBindingFactory; + + private static void init() { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Create a monitor + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + + // Initialize the Tuscany module activators + ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); + for (ModuleActivator activator: moduleActivators.getModuleActivators()) { + activator.start(extensionPoints); + } + + // Get XML input/output factories + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); + transformerFactory = modelFactories.getFactory(TransformerFactory.class); + + // Get contribution workspace and assembly model factories + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class); + atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class); + + // Create XML artifact processors + StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); + + // Create contribution content processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Get the model resolvers + modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + + // Create a composite builder + SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); + IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); + InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); + domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, + documentBuilderFactory, transformerFactory, contractMapper, monitor); + + // Create a node composite builder + nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, + documentBuilderFactory, transformerFactory, contractMapper, null, monitor); + } + + + public static void main(String[] args) throws Exception { + init(); + + // Create workspace model + Workspace workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI storeURI = URI.create("store"); + URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); + workspace.getContributions().add(storeContribution); + + // Read the sample assets contribution + URI assetsURI = URI.create("assets"); + URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); + Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); + workspace.getContributions().add(assetsContribution); + + // Read the sample client contribution + URI clientURI = URI.create("client"); + URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); + Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); + workspace.getContributions().add(clientContribution); + + // Build the contribution dependencies + Set resolved = new HashSet(); + for (Contribution contribution: workspace.getContributions()) { + List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + + // Resolve contributions + for (Contribution dependency: dependencies) { + if (!resolved.contains(dependency)) { + resolved.add(dependency); + contributionProcessor.resolve(dependency, workspace.getModelResolver()); + } + } + } + + // Create a set of nodes, and assign the sample deployables to them + Composite cloudComposite = assemblyFactory.createComposite(); + cloudComposite.setName(new QName("http://sample", "cloud")); + for (int i = 0, n = workspace.getDeployables().size(); i < n; i++) { + + // Create a node + Component node = assemblyFactory.createComponent(); + node.setName("Node" + i); + cloudComposite.getComponents().add(node); + + // Add default binding configuration to the node, our samples use + // Atom bindings so here we're just creating default Atom binding + // configurations, but all the other binding types can be configured + // like that too + ComponentService nodeService = assemblyFactory.createComponentService(); + Binding binding = atomBindingFactory.createAtomBinding(); + binding.setURI("http://localhost:" + (8100 + i)); + nodeService.getBindings().add(binding); + node.getServices().add(nodeService); + + // Assign a deployable to the node + NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation(); + Composite deployable = workspace.getDeployables().get(i); + nodeImplementation.setComposite(deployable); + node.setImplementation(nodeImplementation); + } + + // Print the model describing the nodes that we just built + System.out.println("cloud.composite"); + print(cloudComposite); + System.out.println(); + + // Build the nodes, this will apply their default binding configuration to the + // composites assigned to them + nodeCompositeBuilder.build(cloudComposite); + + // Create a composite model for the domain + Composite domainComposite = assemblyFactory.createComposite(); + domainComposite.setName(new QName("http://sample", "domain")); + + // Add all deployables to it, normally the domain administrator would select + // the deployables to include + domainComposite.getIncludes().addAll(workspace.getDeployables()); + + // Build the domain composite and wire the components included in it + domainCompositeBuilder.build(domainComposite); + + // Print out the resulting domain composite + System.out.println("domain.composite"); + print(domainComposite); + } + + private static void print(Composite composite) throws XMLStreamException, ContributionWriteException, ParserConfigurationException, SAXException, IOException { + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + xmlProcessor.write(composite, writer); + + // Parse and write again to pretty format it + DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setIndent(2); + XMLSerializer serializer = new XMLSerializer(System.out, format); + serializer.serialize(document); + } +} diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/ListComponents.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListComponents.java new file mode 100644 index 0000000000..27cb31d57f --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListComponents.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.util.List; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Component; +import org.apache.tuscany.sca.assembly.ComponentService; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.ModuleActivator; +import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.interfacedef.InterfaceContract; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; + +/** + * Sample ListComponents task. + * + * This sample shows how to use subset of Tuscany to read contribution + * metadata, analyze and resolve contribution dependencies, read and resolve + * the artifacts that they contribute (in particular implementation artifacts, + * interfaces, composites and componentTypes). + * + * The sample first reads the SCA metadata for two sample contributions, then displays + * their dependencies, reads and resolve the artifacts contained in the contributions, + * and finally prints the deployables composites and the components they declare as + * well as their main characteristics (showing that their interfaces and implementations + * for example are actually resolved). + * + * @version $Rev$ $Date$ + */ +public class ListComponents { + + private static URLArtifactProcessor contributionProcessor; + private static ModelResolverExtensionPoint modelResolvers; + private static ModelFactoryExtensionPoint modelFactories; + private static WorkspaceFactory workspaceFactory; + private static ContributionDependencyBuilder contributionDependencyBuilder; + + private static void init() { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Initialize the Tuscany module activators + ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); + for (ModuleActivator activator: moduleActivators.getModuleActivators()) { + activator.start(extensionPoints); + } + + // Get workspace contribution factory + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + + // Create contribution content processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Get the model resolvers + modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); + + // Create a monitor + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + } + + + public static void main(String[] args) throws Exception { + init(); + + // Create workspace model + Workspace workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI storeURI = URI.create("store"); + URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); + workspace.getContributions().add(storeContribution); + + // Read the sample assets contribution + URI assetsURI = URI.create("assets"); + URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); + Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); + workspace.getContributions().add(assetsContribution); + + // Build the store contribution dependencies + List dependencies = contributionDependencyBuilder.buildContributionDependencies(storeContribution, workspace); + + // Resolve the contributions + for (Contribution contribution: dependencies) { + contributionProcessor.resolve(contribution, workspace.getModelResolver()); + } + + // List the components declared in the deployables found in the + // contribution, their services, bindings, interfaces, and implementations + for (Composite deployable: storeContribution.getDeployables()) { + System.out.println("Deployable: " + deployable.getName()); + for (Component component: deployable.getComponents()) { + System.out.println(" component: " + component.getName()); + for (ComponentService componentService: component.getServices()) { + System.out.println(" componentService: " + componentService.getName()); + for (Binding binding: componentService.getBindings()) { + System.out.println(" binding: " + binding.getClass() + " - " + binding.getURI()); + } + } + Implementation implementation = component.getImplementation(); + System.out.println(" implementation: " + implementation); + for (Service service: implementation.getServices()) { + System.out.println(" service: " + service.getName()); + InterfaceContract contract = service.getInterfaceContract(); + System.out.println(" interface: " + contract.getInterface()); + } + } + } + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDependencies.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDependencies.java new file mode 100644 index 0000000000..1bf8124682 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDependencies.java @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.File; +import java.net.URI; +import java.net.URL; + +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; + +/** + * Sample ListDependencies task. + * + * This sample shows how to use a subset of Tuscany to read contribution + * metadata, analyze and resolve contribution dependencies given a set of + * available contributions. + * + * The sample reads the SCA metadata for two sample contributions then + * prints their dependencies. + * + * @version $Rev$ $Date$ + */ +public class ListDependencies { + + private static URLArtifactProcessor contributionProcessor; + private static WorkspaceFactory workspaceFactory; + private static ContributionDependencyBuilder contributionDependencyBuilder; + + private static void init() throws Exception { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Get contribution, workspace and assembly model factories + ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + + // Create contribution info processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Create a monitor + UtilityExtensionPoint services = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = services.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + } + + + public static void main(String[] args) throws Exception { + init(); + + // Create workspace model + Workspace workspace = workspaceFactory.createWorkspace(); + + // Read the contribution info for the sample contribution + URI storeURI = URI.create("store"); + URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution storeContribution = (Contribution)contributionProcessor.read(null, storeURI, storeURL); + workspace.getContributions().add(storeContribution); + + // Read the contribution info for the assets contribution + URI assetsURI = URI.create("assets"); + URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); + Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); + workspace.getContributions().add(assetsContribution); + + // List the contribution dependencies of each contribution + for (Contribution contribution: workspace.getContributions()) { + System.out.println("Contribution: " + contribution.getURI()); + for (Contribution dependency: contributionDependencyBuilder.buildContributionDependencies(contribution, workspace)) { + System.out.println(" dependency: " + dependency.getURI()); + } + } + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDeployables.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDeployables.java new file mode 100644 index 0000000000..f5f0b9c655 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/ListDeployables.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.File; +import java.net.URI; +import java.net.URL; + +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; + +/** + * Sample ListDeployables task. + * + * This sample shows how to use a subset of Tuscany to read contribution + * metadata. + * + * The sample reads the SCA metadata for two sample contributions then + * prints the names of their deployable composites. + * + * @version $Rev$ $Date$ + */ +public class ListDeployables { + + private static URLArtifactProcessor contributionProcessor; + + private static void init() { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Create contribution info processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + } + + public static void main(String[] args) throws Exception { + init(); + + // Read the contribution info for the sample contribution + URI uri = URI.create("store"); + URL url = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution contribution = contributionProcessor.read(null, uri, url); + + // List the deployables in the contribution + for (Composite deployable: contribution.getDeployables()) { + System.out.println("Deployable: " + deployable.getName()); + } + + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/main/java/manager/WireComponents.java b/java/sca/contrib/samples/domain-management/src/main/java/manager/WireComponents.java new file mode 100644 index 0000000000..d24d5c67c9 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/main/java/manager/WireComponents.java @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package manager; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.net.URI; +import java.net.URL; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLOutputFactory; +import javax.xml.stream.XMLStreamWriter; +import javax.xml.transform.TransformerFactory; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.Composite; +import org.apache.tuscany.sca.assembly.SCABindingFactory; +import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; +import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; +import org.apache.tuscany.sca.contribution.Contribution; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; +import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; +import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; +import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; +import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.ModuleActivator; +import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; +import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.monitor.MonitorFactory; +import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; +import org.apache.tuscany.sca.workspace.Workspace; +import org.apache.tuscany.sca.workspace.WorkspaceFactory; +import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; +import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; +import org.apache.xml.serialize.OutputFormat; +import org.apache.xml.serialize.XMLSerializer; +import org.w3c.dom.Document; + +/** + * Sample WireComponents task. + * + * This sample shows how to use a subset of Tuscany to read contribution + * metadata, analyze and resolve contribution dependencies, read and resolve + * the artifacts that they contribute (in particular implementation artifacts, + * interfaces, composites, componentTypes etc.) and assembe and wire the + * deployable composites together in a composite model representing an SCA + * domain composite. + * + * The sample first reads the SCA metadata for three sample contributions, + * reads and resolve the artifacts contained in the contributions, includes all their + * deployable composites in a composite model representing an SCA domain, then + * uses a composite builder utility to assemble and wire the composites together. + * Finally it prints the resulting domain composite model. + * + * @version $Rev$ $Date$ + */ +public class WireComponents { + + private static URLArtifactProcessor contributionProcessor; + private static ModelResolverExtensionPoint modelResolvers; + private static ModelFactoryExtensionPoint modelFactories; + private static WorkspaceFactory workspaceFactory; + private static AssemblyFactory assemblyFactory; + private static XMLOutputFactory outputFactory; + private static DocumentBuilderFactory documentBuilderFactory; + private static TransformerFactory transformerFactory; + private static StAXArtifactProcessor xmlProcessor; + private static ContributionDependencyBuilder contributionDependencyBuilder; + private static CompositeBuilder domainCompositeBuilder; + + private static void init() { + + // Create extension point registry + ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); + + // Create a monitor + UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); + MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); + Monitor monitor = monitorFactory.createMonitor(); + + // Initialize the Tuscany module activators + ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); + for (ModuleActivator activator: moduleActivators.getModuleActivators()) { + activator.start(extensionPoints); + } + + // Get XML input/output factories + modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); + XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); + outputFactory = modelFactories.getFactory(XMLOutputFactory.class); + documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); + transformerFactory = modelFactories.getFactory(TransformerFactory.class); + + // Get contribution workspace and assembly model factories + workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); + assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + + // Create XML artifact processors + StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); + xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); + + // Create contribution content processor + URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); + contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); + + // Get the model resolvers + modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); + + // Create a contribution dependency builder + contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); + + // Create a composite builder + SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); + IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); + InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); + domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, + documentBuilderFactory, transformerFactory, contractMapper, monitor); + + } + + + public static void main(String[] args) throws Exception { + init(); + + // Create workspace model + Workspace workspace = workspaceFactory.createWorkspace(); + workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); + + // Read the sample store contribution + URI storeURI = URI.create("store"); + URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); + Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); + workspace.getContributions().add(storeContribution); + + // Read the sample assets contribution + URI assetsURI = URI.create("assets"); + URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); + Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); + workspace.getContributions().add(assetsContribution); + + // Read the sample client contribution + URI clientURI = URI.create("client"); + URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); + Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); + workspace.getContributions().add(clientContribution); + + // Build the contribution dependencies + Set resolved = new HashSet(); + for (Contribution contribution: workspace.getContributions()) { + List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); + + // Resolve contributions + for (Contribution dependency: dependencies) { + if (!resolved.contains(dependency)) { + resolved.add(dependency); + contributionProcessor.resolve(contribution, workspace.getModelResolver()); + } + } + } + + // Create a composite model for the domain + Composite domainComposite = assemblyFactory.createComposite(); + domainComposite.setName(new QName("http://sample", "domain")); + + // Add all deployables to it, normally the domain administrator would select + // the deployables to include + domainComposite.getIncludes().addAll(workspace.getDeployables()); + + // Build the domain composite and wire the components included in it + domainCompositeBuilder.build(domainComposite); + + // Print out the resulting domain composite + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); + xmlProcessor.write(domainComposite, writer); + + // Parse and write again to pretty format it + DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); + Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); + OutputFormat format = new OutputFormat(); + format.setIndenting(true); + format.setIndent(2); + XMLSerializer serializer = new XMLSerializer(System.out, format); + serializer.serialize(document); + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/test/java/services/Cart.java b/java/sca/contrib/samples/domain-management/src/test/java/services/Cart.java new file mode 100644 index 0000000000..3fb5439bc3 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/java/services/Cart.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Cart extends Collection { + +} diff --git a/java/sca/contrib/samples/domain-management/src/test/java/services/Item.java b/java/sca/contrib/samples/domain-management/src/test/java/services/Item.java new file mode 100644 index 0000000000..81cefcdbef --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/java/services/Item.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + + +public class Item { + private String name; + private String price; + private String origin; + + public Item() { + } + + public Item(String name, String price, String origin) { + this.name = name; + this.price = price; + this.origin = origin; + } + + public Item(String name, String price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + + public String getOrigin() { + return origin; + } + + public void setOrigin(String origin) { + this.origin = origin; + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java b/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java new file mode 100644 index 0000000000..f053ec9f48 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartClientImpl implements Cart { + + @Reference + public Cart cart; + + public Entry[] getAll() { + return cart.getAll(); + } + + public Item get(String key) throws NotFoundException { + return cart.get(key); + } + + public String post(String key, Item item) { + return cart.post(key, item); + } + + public void put(String key, Item item) throws NotFoundException { + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + cart.delete(key); + } + + public Entry[] query(String queryString) { + return cart.query(queryString); + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartImpl.java b/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartImpl.java new file mode 100644 index 0000000000..9ef59df7a8 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/java/services/ShoppingCartImpl.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartImpl implements Cart { + + private Map cart; + + @Init + public void init() { + cart = new HashMap(); + } + + public Entry[] getAll() { + Entry[] entries = new Entry[cart.size()]; + int i = 0; + for (Map.Entry e: cart.entrySet()) { + entries[i++] = new Entry(e.getKey(), e.getValue()); + } + return entries; + } + + public Item get(String key) throws NotFoundException { + Item item = cart.get(key); + if (item == null) { + throw new NotFoundException(key); + } else { + return item; + } + } + + public String post(String key, Item item) { + if (key == null) { + key ="cart-" + UUID.randomUUID().toString(); + } + cart.put(key, item); + return key; + } + + public void put(String key, Item item) throws NotFoundException { + if (!cart.containsKey(key)) { + throw new NotFoundException(key); + } + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + if (key == null || key.equals("")) { + cart.clear(); + } else { + Item item = cart.remove(key); + if (item == null) + throw new NotFoundException(key); + } + } + + public Entry[] query(String queryString) { + List> entries = new ArrayList>(); + if (queryString.startsWith("name=")) { + String name = queryString.substring(5); + for (Map.Entry e: cart.entrySet()) { + Item item = e.getValue(); + if (item.getName().equals(name)) { + entries.add(new Entry(e.getKey(), e.getValue())); + } + } + } + return entries.toArray(new Entry[entries.size()]); + } + +} diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/assembly/assets.xml b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/assets.xml new file mode 100644 index 0000000000..10693a89e6 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/assets.xml @@ -0,0 +1,38 @@ + + + + assets + false + + jar + + + + + target/test-classes/assets + / + + + target/test-classes/services + /services + + + + diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/assembly/client.xml b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/client.xml new file mode 100644 index 0000000000..5b34693bee --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/client.xml @@ -0,0 +1,34 @@ + + + + client + false + + jar + + + + + target/test-classes/client + / + + + + diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/assembly/store.xml b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/store.xml new file mode 100644 index 0000000000..d19b7eb161 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/assembly/store.xml @@ -0,0 +1,34 @@ + + + + store + false + + jar + + + + + target/test-classes/store + / + + + + diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml b/java/sca/contrib/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..33fe814c3a --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml b/java/sca/contrib/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..14e1cdb672 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/client/client.composite b/java/sca/contrib/samples/domain-management/src/test/resources/client/client.composite new file mode 100644 index 0000000000..1279b319c4 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/client/client.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml b/java/sca/contrib/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..52348106f2 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/domain-management/src/test/resources/store/store.composite b/java/sca/contrib/samples/domain-management/src/test/resources/store/store.composite new file mode 100644 index 0000000000..d4f18771d8 --- /dev/null +++ b/java/sca/contrib/samples/domain-management/src/test/resources/store/store.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/domain-webapp/README b/java/sca/contrib/samples/domain-webapp/README new file mode 100644 index 0000000000..c01a0dd39a --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/README @@ -0,0 +1,310 @@ +Domain Webapp Sample +==================== + +Not actually a webapp just yet as webapp host need to use the new domain for it to work. +If you run the DomainServer in a debugger you will get a server that provides a registry +for servide URLs, listens for Nodes starting and stopping and provides a web page where +you can see what nodes are registered and pull up their web pages. + +Use the nodes from the calculator-distributed to register with this domain + + +========================================== +Below copied from calculator sample as a template for when this gets done + + +This sample implements a simple calculator using SCA components. It uses +exactly the same calculator application classes as the calculator sample but +runs the application distributed across three nodes. + +A node in this sample means an instance of the Tuscany SCA java runtime running +in a Java virtual machine. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open four command prompts and +navigate to this sample directory in each one. There is one command to be run +in each command prompt: + +ant runDomainNode +ant runNodeB +ant runNodeC +ant runNodeA + +Please run the commands in this order. + +OR if you don't have ant, on Windows use + +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.DomainNode +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC +java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA + +and on *nix do + +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.DomainNode +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC +java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA + + +The processes started on each of these command prompts can be ended by pressing +the key. + + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. NodeA exercises this interface by calling add, subtract, multiply and +divide operations. + +In the case of add and subtract the runtime recognises that +it can't find these services locally and, using the remote (web services) +version of the default SCA binding contacts the add service running in NodeB +and the subtract service running in NodeC. + +On the command prompt where you started NodeA, you would see output of invoking the +calculator functions distributed over NodeB and and NodeC. On the command prompts +where you have started NodeB and NodeC, you would see log messages that indicate that +the add and substract services where called on these nodes respectively. + +The sample demonstrates that the calculator application can be distributed +across multiple nodes with no change to the application or to the SCA description +files. + + +calculator/ + src/ + main/ + java/ + calculator/ + CalculatorService.java - the first component, calls +-/* as + appropriate + AddService.java - adds two numbers + AddServiceImpl.java + SubtractService.java - subtracts one number from another + SubtractServiceImpl.java + MultiplyService.java - multiplies two numbers + MultiplyServiceImpl.java + DivideService.java - divides one number by another + DivideServiceImpl.java + node/ + CalculatorNode.java - runs up an sca application based on + configuration given on the command + line in the form + + CalculatorNode + + it looks for a directory name the same + as and loads the composites + there + + if = nodeA it calls the + +-/* operations otherwise it behaves + like a server and waits for service + requests + DomainNode.java - the node that provides the service + discovery mechanism to the distributed + domain + resources/ + domain - the SCA assembly for the service discovery + function + management/ - the SCA assembly for each nodes management + function + nodeA - the SCA assembly for nodeA's part of the + calculator application + nodeB - the SCA assembly for nodeB's part of the + calculator application + nodeC - the SCA assembly for nodeB's part of the + calculator application + test/ + java/ + calculator/ + DomainInMemoryTestCase.java - JUnit test case which runs all of the + separate ndes in a single VM for test + purposes + calculator-distributed.png - a pictorial representation of the sample + .composite files + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd calculator-distributed +ant compile +ant runDomainNode +ant runNodeB +ant runNodeC +ant runNodeA + +You should see the following output from the four separate command prompt: + +runDomainNode: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] 23-Aug-2007 17:40:40 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8080/ServiceDiscoveryC +omponent/ServiceDiscovery + [java] Domain node started (press enter to shutdown) + [java] Registering service: [mydomain nodeB AddServiceComponent org.apache. +tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent] + [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap +ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon +ent] + [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca +ny.sca.assembly.SCABinding] + [java] Matching service url: http://localhost:8086/SubtractServiceComponent + + [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc +a.assembly.SCABinding] + [java] Matching service url: http://localhost:8085/AddServiceComponent + [java] Java Result: 1 +Terminate batch job (Y/N)? y + + + +runNodeB: + [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ +target/classes/management/ + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Registering service: [mydomain nodeB AddServiceComponent/ org.apache +.tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent] + [java] 23-Aug-2007 17:41:25 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8085/AddServiceCompone +nt + [java] Node started (press enter to shutdown) + [java] AddService - add 3.0 and 2.0 + + +runNodeC: + [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ +target/classes/management/ + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap +ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon +ent] + [java] 23-Aug-2007 17:41:51 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] Node started (press enter to shutdown) + [java] INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceCo +mponent + [java] SubtractService - subtract 3.0 and 2.0 +Terminate batch job (Y/N)? y + + +runNodeA: + [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ +target/classes/management/ + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co +mpositeBuilderImpl$1 problem + [java] WARNING: [WARNING] Component reference target not found, it might be + a remote service: AddServiceComponent null + [java] + [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co +mpositeBuilderImpl$1 problem + [java] WARNING: [WARNING] Component reference target not found, it might be + a remote service: SubtractServiceComponent null + [java] + [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca +ny.sca.assembly.SCABinding] + [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc +a.assembly.SCABinding] + [java] CalculatorService - add 3.0 and 2.0 + [java] 3 + 2=5.0 + [java] CalculatorService - subtract 3.0 and 2.0 + [java] 3 - 2=1.0 + [java] CalculatorService - multiply 3.0 and 2.0 + [java] 3 * 2=6.0 + [java] CalculatorService - divide 3.0 and 2.0 + [java] 3 / 2=1.5 + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When running from Maven the four nodes all run within +Java virtual machine. + +cd calculator-distributed +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running calculator.DomainInMemoryTestCase +Setting up distributed nodes +file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class +es/management/ +log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX +Utils). +log4j:WARN Please initialize the log4j system properly. +23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild +erImpl$1 problem +WARNING: [WARNING] Component reference target not found, it might be a remote se +rvice: AddServiceComponent null + +23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild +erImpl$1 problem +WARNING: [WARNING] Component reference target not found, it might be a remote se +rvice: SubtractServiceComponent null + +file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class +es/management/ +Registering service: [mydomain nodeB AddServiceComponent org.apache.tuscany.sca. +assembly.SCABinding http://localhost:8085/AddServiceComponent] +file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class +es/management/ +Registering service: [mydomain nodeC SubtractServiceComponent org.apache.tuscany +.sca.assembly.SCABinding http://localhost:8086/SubtractServiceComponent] +Finding service: [mydomain SubtractServiceComponent org.apache.tuscany.sca.assem +bly.SCABinding] +Matching service url: http://localhost:8086/SubtractServiceComponent +Finding service: [mydomain AddServiceComponent org.apache.tuscany.sca.assembly.S +CABinding] +Matching service url: http://localhost:8085/AddServiceComponent +23-Aug-2007 18:18:45 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap +ping +INFO: Added Servlet mapping: http://localhost:8085/AddServiceComponent +23-Aug-2007 18:18:47 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap +ping +INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceComponent +CalculatorService - add 3.0 and 2.0 +AddService - add 3.0 and 2.0 +CalculatorService - subtract 3.0 and 2.0 +SubtractService - subtract 3.0 and 2.0 +CalculatorService - multiply 3.0 and 2.0 +CalculatorService - divide 3.0 and 2.0 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.14 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + + +This shows that the Junit test cases have run successfully. + +Known Bug : +--------- +The processes that are running NodeB and NodeC do not seem to end on pressing the +. This will be fixed for the next release. For this release you should use +^C (Control C) to exit these processes. + + diff --git a/java/sca/contrib/samples/domain-webapp/build.xml b/java/sca/contrib/samples/domain-webapp/build.xml new file mode 100644 index 0000000000..e008e3c9f0 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/build.xml @@ -0,0 +1,296 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/domain-webapp/pom.xml b/java/sca/contrib/samples/domain-webapp/pom.xml new file mode 100644 index 0000000000..0b4309a244 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/pom.xml @@ -0,0 +1,101 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-samples + 2.0-SNAPSHOT + ../pom.xml + + sample-domain-webapp + Apache Tuscany SCA Domain Webapp Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-domain-impl + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2 + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-http + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/domain-webapp/src/main/java/node/DomainServer.java b/java/sca/contrib/samples/domain-webapp/src/main/java/node/DomainServer.java new file mode 100644 index 0000000000..ea3cddc01b --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/src/main/java/node/DomainServer.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package node; + +import java.io.IOException; + + +/** + * This server program that loads a composite to provide simple registry function. + * This server can be replaced with any registry that is appropriate but the components + * in each node that talk to the registry should be replaced also. + */ +public class DomainServer { + + public static void main(String[] args) { + try { +/* + NodeImpl node = new NodeImpl(); + node.start(); + node.getContributionManager().startContribution(DomainServer.class.getClassLoader().getResource(".")); + + try { + System.out.println("Domain server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + node.stop(); + System.out.println("Domain server stopped"); +*/ + } catch (Exception ex) { + System.out.println("Exception in domain server " + + ex.toString()); + } + } + +} diff --git a/java/sca/contrib/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml new file mode 100755 index 0000000000..fbe5880db6 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/domain-webapp/src/main/resources/domain.composite b/java/sca/contrib/samples/domain-webapp/src/main/resources/domain.composite new file mode 100644 index 0000000000..dbaaebd3c7 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/src/main/resources/domain.composite @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/index.html b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/index.html new file mode 100644 index 0000000000..425bd73734 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/index.html @@ -0,0 +1,354 @@ + + + +Apache Tuscany Domain + + + + + + + + + + + + +

Apache Tuscany Domain

+
+ +

Domain Name:

+ +
+ +

+ +

+ + + diff --git a/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/node.png b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/node.png new file mode 100644 index 0000000000..b3c949d224 Binary files /dev/null and b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/node.png differ diff --git a/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/style.css b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/style.css new file mode 100644 index 0000000000..f5bbf23379 --- /dev/null +++ b/java/sca/contrib/samples/domain-webapp/src/main/resources/webroot/style.css @@ -0,0 +1,176 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +p,table,li,h1,h2,h3 +{ +font-family: verdana, arial, 'sans serif'; +} + +p, h1, h2, h3, table, li, hr +{ +margin-left: 10pt; +} + +table +{ +border-color: black; +border-collapse: separate; +border-spacing: 0px 1px; + +margin-right: 10pt; +margin-left: 10pt; +width: 800px; +} + +.sourceDetailsTable +{ +width: 600px; +} + +tr, td +{ +margin-left: 0pt; +margin-right: 0pt; +padding-left: 10pt; +font-size: 90%; +} + +p,li,th +{ +font-size: 90%; +margin-left: 10pt; +} + +pre +{ +margin-left: 10pt; +} + +body +{ +#ffffff; +} + +h1,h2,h3,hr +{ +color: firebrick; +} + +a:link {COLOR: firebrick;} +a:visited {COLOR: firebrick;} +a:active {COLOR: navy;} + +.link +{ +COLOR: firebrick; +text-decoration: underline; +} + +.clickable +{ +cursor: pointer +} + +.unread_title +{ +font-weight: bold; +} + +.read_title +{ +font-weight: normal; +} + +.summary +{ +color: DimGrey; +} + +.hidden +{ +display: none; +} + +.source_name +{ +width: 600px; +} + +.alert_text +{ +width: 600px; +} + +.alert_data +{ +margin-left: 10px; +width: 800px; +height: 800px; +} + +.source_0 +{ +background-color: LightGreen; +} + +.source_1 +{ +background-color: LightSkyBlue; +} + +.source_2 +{ +background-color: Khaki; +} + +.source_3 +{ +background-color: LightPink; +} + +.source_4 +{ +background-color: Orange; +} + +.source_5 +{ +background-color: LightCoral; +} + +.source_6 +{ +background-color: Orchid; +} + +.source_7 +{ +background-color: Peru; +} + +.source_8 +{ +background-color: SpringGreen; +} + +.source_9 +{ +background-color: LightGrey; +} + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/README b/java/sca/contrib/samples/feed-aggregator-webapp/README new file mode 100644 index 0000000000..3668a7705e --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/README @@ -0,0 +1,55 @@ +Feed-aggregator-webapp Sample +============================= +This sample demonstrates using the Feed binding to aggregate ATOM and RSS +feeds and publish a new aggregated feed in a webapp. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file +(target/sample-feed-aggregator-webapp.war) to your web application server. + +Once the web app is deployed use your browser to visit the following URL: + +http://localhost:8080/sample-feed-aggregator-webapp + +You will then see the following displayed in your Web browser. + +http://localhost:8083/atomAggregator +http://localhost:8083/atomAggregator/atomsvc +http://localhost:8083/rssAggregator + +** Please note that if your browser is not configured correctly to receive +feed information, you will be prompted to open each file that contains the feed +information in xml. + + +Building And Running The Sample Using Ant +------------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd feed-aggregator-webapp +ant package + +This should result in a war file (sample-feed-aggregator-webapp.war) in the +target directory. Copy this war file to your web app deployment directory and +follow instructions at the begining of this README. + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd feed-aggregator-webapp +mvn + +This should result in a war file (sample-feed-aggregator-webapp.war) in the +target directory. Follow the steps described in the previous section for +running the web app and for the expected results. + + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.png b/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.png new file mode 100644 index 0000000000..1af95a5eff Binary files /dev/null and b/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.png differ diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg b/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg new file mode 100644 index 0000000000..a861a5c50f --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg @@ -0,0 +1,382 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + FeedAggregator + Sort + + newFirst = true + + RssAggregator + + + + + AtomAggregator + + + Rss Sample + Atom Sample + + + + + + + + + + Engadget + BBC + Oreilly + Apache + + + RSS Atom + sample-feed-aggregator-webapp.war + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/pom.xml b/java/sca/contrib/samples/feed-aggregator-webapp/pom.xml new file mode 100644 index 0000000000..874327c7b1 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/pom.xml @@ -0,0 +1,108 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-feed-aggregator-webapp + war + Apache Tuscany SCA Atom+RSS Feed Aggregator Sample Webapp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java new file mode 100644 index 0000000000..2c90c0db8c --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.apache.abdera.Abdera; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Document; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.abdera.model.Person; +import org.apache.abdera.parser.Parser; +import org.apache.tuscany.sca.binding.atom.collection.Collection; +import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.feed.synd.SyndFeedImpl; +import com.sun.syndication.io.SyndFeedOutput; + +/** + * Implementation of an SCA component that aggregates several + * Atom and RSS feeds. + * + * @version $Rev$ $Date$ + */ +public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection { + + @Reference(required = false) + public Collection atomFeed1; + @Reference(required = false) + public Collection atomFeed2; + + @Reference(required = false) + public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1; + @Reference(required = false) + public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2; + + @Reference(required = false) + public Sort sort; + + @Property + public String feedTitle = "Aggregated Feed"; + @Property + public String feedDescription = "Anonymous Aggregated Feed"; + @Property + public String feedAuthor = "anonymous"; + + public Feed getFeed() { + + // Create a new Feed + Factory factory = Abdera.getNewFactory(); + Feed feed = factory.newFeed(); + feed.setTitle(feedTitle); + feed.setSubtitle(feedDescription); + Person author = factory.newAuthor(); + author.setName(feedAuthor); + feed.addAuthor(author); + feed.addLink("http://tuscany.apache.org", "alternate"); + + // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2 + List entries = new ArrayList(); + if (atomFeed1 != null) { + try { + entries.addAll(atomFeed1.getFeed().getEntries()); + } catch (Exception e) {} + } + if (atomFeed2 != null) { + try { + entries.addAll(atomFeed2.getFeed().getEntries()); + } catch (Exception e) {} + } + if (rssFeed1 != null) { + try { + entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries()); + } catch (Exception e) {} + } + if (rssFeed2 != null) { + try { + entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries()); + } catch (Exception e) {} + } + + // Sort entries by published date + if (sort != null) { + entries = sort.sort(entries); + } + + // Add the entries to the new feed + for (Entry entry: entries) { + feed.addEntry(entry); + } + + return feed; + } + + public Feed query(String queryString) { + Factory factory = Abdera.getNewFactory(); + Feed feed = factory.newFeed(); + feed.setTitle(feedTitle); + feed.setSubtitle(feedDescription); + Person author = factory.newAuthor(); + author.setName(feedAuthor); + feed.addAuthor(author); + feed.addLink("http://tuscany.apache.org", "alternate"); + + Feed allFeed = getFeed(); + if (queryString.startsWith("title=")) { + String title = queryString.substring(6); + + for (Entry entry: allFeed.getEntries()) { + if (entry.getTitle().contains(title)) { + feed.addEntry(entry); + } + } + } + return feed; + } + + public void delete(String id) throws NotFoundException { + } + + public Entry get(String id) throws NotFoundException { + return null; + } + + public Entry post(Entry entry) { + return null; + } + + public void put(String id, Entry entry) throws NotFoundException { + } + + /** + * Convert a ROME feed to an Abdera feed. + * + * @param romeFeed + * @return + */ + private static Feed atomFeed(SyndFeed syndFeed) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + syndFeed.setFeedType("atom_1.0"); + SyndFeedOutput syndOutput = new SyndFeedOutput(); + try { + syndOutput.output(syndFeed, new OutputStreamWriter(bos)); + } catch (Exception e) { + throw new RuntimeException(e); + } + Parser parser = Abdera.getNewParser(); + Document document = parser.parse(new ByteArrayInputStream(bos.toByteArray())); + + return document.getRoot(); + } +} diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java new file mode 100644 index 0000000000..dec073c36b --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.util.List; + +import org.apache.abdera.model.Entry; + +/** + * The Sort service business interface. + * + * @version $Rev$ $Date$ + */ +public interface Sort { + + /** + * Sort feed entries by published date. + * @param entries + * @return + */ + List sort(List entries); +} diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java new file mode 100644 index 0000000000..354ef2d369 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.apache.abdera.model.Entry; +import org.oasisopen.sca.annotation.Property; + +/** + * Implementation of a Feed Sort service component. + * + * @version $Rev$ $Date$ + */ +public class SortImpl implements Sort { + + @Property + public boolean newFirst = true; + + @SuppressWarnings("unchecked") + public List sort(List entries) { + Entry[] entriesArray = new Entry[entries.size()]; + entriesArray = (Entry[])entries.toArray(entriesArray); + Arrays.sort(entriesArray, new Comparator() { + public int compare(final Object xObj, final Object yObj) { + Date xDate = ((Entry)xObj).getUpdated(); + Date yDate = ((Entry)yObj).getUpdated(); + if (xDate == null) + return -1; + if (newFirst) + return yDate.compareTo(xDate); + else + return xDate.compareTo(yDate); + } + }); + return Arrays.asList(entriesArray); + } +} diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite new file mode 100644 index 0000000000..736563098f --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + RSS Aggregator Sample + + + + true + + + + + + + + + + + + Atom Aggregator Sample + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b67fe843ca --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..dea3980e4d --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Feed Aggregator Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + index.html + + + diff --git a/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/index.html b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/index.html new file mode 100644 index 0000000000..7b33391a87 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator-webapp/src/main/webapp/index.html @@ -0,0 +1,32 @@ + + + + Apache Tuscany Feed Aggregator Sample + + + +

Apache Tuscany Feed Aggregator Sample

+

To read the aggregated feeds, point your Web browser to the following addresses:

+
http://localhost:8083/sample-feed-aggregator-webapp/atomAggregator +
http://localhost:8083/sample-feed-aggregator-webapp/atomAggregator/atomsvc (for the Atom service document) +
http://localhost:8083/sample-feed-aggregator-webapp/rssAggregator + + + diff --git a/java/sca/contrib/samples/feed-aggregator/README b/java/sca/contrib/samples/feed-aggregator/README new file mode 100644 index 0000000000..f73baec2fd --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/README @@ -0,0 +1,110 @@ +Feed Aggregator Sample +====================================== +This sample demonstrates using the Feed binding to aggregate ATOM and RSS +feeds and publish a new aggregated feed. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you run the sample using ant, navigate to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-feed-aggregator.jar launch.LaunchFeedServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-feed-aggregator.jar launch.LaunchFeedServer + +You should see the following output on the screen. + +run: + [java] Added Servlet mapping: http://localhost:8083/rssAggregator + [java] Added Servlet mapping: http://localhost:8083/atomAggregator/* + [java] Sample Feed server started (press enter to shutdown) + + [java] To read the aggregated feeds, point your Web browser to the following addresses: + [java] http://localhost:8083/atomAggregator + [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document) + [java] http://localhost:8083/rssAggregator + +As this point the aggregated Feeds are exposed by a web server started +automatically by the SCA runtime. You can later stop the server by pressing enter. + +Now that the server is started you can point your Web browser to each URL of the +aggregated feeds to see the information in your broswer. These URLs are: + +http://localhost:8083/atomAggregator +http://localhost:8083/atomAggregator/atomsvc +http://localhost:8083/rssAggregator + +** Please note that if your browser is not configured correctly to receive +feed information, you will be prompted to open each file that contains the feed +information in xml. + +Sample Overview +--------------- +The sample provides a single component exposing a Web resource. + +web-resource/ + src/ + main/ + java/ + feed/ + AggregatorImpl.java - implementation of the Feed + aggregator component + Sort.java - utilty interface + SortImpl.java - implementation of the Sort component + launch + LaunchFeedServer.java - starts the SCA Runtime and + publishes the aggregated feeds + resources/ + FeedAggregator.composite - the SCA assembly for this sample + feed-aggregator.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + + +Details of how this sample works +-------------------------------- +1. AggregatorImpl is used to implement the two main components here (RSSAggregator & AtomAggregator). +2. AggregatorImpl directly implements the Tuscany Atom Collection interface. It is a component + that provides an Atom feed to respond (see tuscany/modules/binding-atom-abdera) +3. The AggregatorImpl component is not explicitly configured using nested element nor its + implementation class is annotated with @Service annotation. Instead, the Tuscany Atom Collection interface + defines its services using @Remotable annotation. + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd feed-aggregator +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Added Servlet mapping: http://localhost:8083/rssAggregator + [java] Added Servlet mapping: http://localhost:8083/atomAggregator/* + [java] Sample Feed server started (press enter to shutdown) + + [java] To read the aggregated feeds, point your Web browser to the following addresses: + [java] http://localhost:8083/atomAggregator + [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document) + [java] http://localhost:8083/rssAggregator + + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built using +Maven as follows. + +cd feed-aggregator +mvn + diff --git a/java/sca/contrib/samples/feed-aggregator/build.xml b/java/sca/contrib/samples/feed-aggregator/build.xml new file mode 100644 index 0000000000..0ab6fed7fc --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/feed-aggregator/feed-aggregator.png b/java/sca/contrib/samples/feed-aggregator/feed-aggregator.png new file mode 100644 index 0000000000..c8fea8a7b8 Binary files /dev/null and b/java/sca/contrib/samples/feed-aggregator/feed-aggregator.png differ diff --git a/java/sca/contrib/samples/feed-aggregator/feed-aggregator.svg b/java/sca/contrib/samples/feed-aggregator/feed-aggregator.svg new file mode 100644 index 0000000000..72fe6a00ac --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/feed-aggregator.svg @@ -0,0 +1,364 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + FeedAggregator + Sort + + newFirst = true + + RssAggregator + + + + + AtomAggregator + + + Rss Sample + Atom Sample + + + + + + + + + + Engadget + BBC + Oreilly + Apache + + + RSS Atom + diff --git a/java/sca/contrib/samples/feed-aggregator/pom.xml b/java/sca/contrib/samples/feed-aggregator/pom.xml new file mode 100644 index 0000000000..ae2aee112c --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/pom.xml @@ -0,0 +1,84 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../pom.xml + + sample-feed-aggregator + Apache Tuscany SCA Atom+RSS Feed Aggregator Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java new file mode 100644 index 0000000000..999e9d5520 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.abdera.Abdera; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Document; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.abdera.model.Person; +import org.apache.abdera.parser.Parser; +import org.apache.tuscany.sca.binding.atom.collection.Collection; +import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +import com.sun.syndication.feed.synd.SyndFeed; +import com.sun.syndication.io.SyndFeedOutput; + +/** + * Implementation of an SCA component that aggregates several + * Atom and RSS feeds. + * + * @version $Rev$ $Date$ + */ +public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection { + + @Reference(required = false) + public Collection atomFeed1; + @Reference(required = false) + public Collection atomFeed2; + + @Reference(required = false) + public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1; + @Reference(required = false) + public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2; + + @Reference(required = false) + public Sort sort; + + @Property + public String feedTitle = "Aggregated Feed"; + @Property + public String feedDescription = "Anonymous Aggregated Feed"; + @Property + public String feedAuthor = "anonymous"; + + public Feed getFeed() { + + // Create a new Feed + Factory factory = Abdera.getNewFactory(); + Feed feed = factory.newFeed(); + feed.setTitle(feedTitle); + feed.setSubtitle(feedDescription); + Person author = factory.newAuthor(); + author.setName(feedAuthor); + feed.addAuthor(author); + feed.addLink("http://tuscany.apache.org/", "alternate"); + + // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2 + List entries = new ArrayList(); + if (atomFeed1 != null) { + try { + entries.addAll(atomFeed1.getFeed().getEntries()); + } catch (Exception e) {} + } + if (atomFeed2 != null) { + try { + entries.addAll(atomFeed2.getFeed().getEntries()); + } catch (Exception e) {} + } + if (rssFeed1 != null) { + try { + entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries()); + } catch (Exception e) {} + } + if (rssFeed2 != null) { + try { + entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries()); + } catch (Exception e) {} + } + + // Sort entries by updated date + if (sort != null) { + entries = sort.sort(entries); + } + + // Add the entries to the new feed + // Also synthesize a feed id and updated field base on entries + Date feedUpdated = new Date( 0 ); + for (Entry entry: entries) { + Date entryUpdated = entry.getUpdated(); + if (( entryUpdated != null ) && ( entryUpdated.compareTo( feedUpdated ) > 0 )) { + feedUpdated = entryUpdated; + } + feed.addEntry(entry); + } + feed.setUpdated( feedUpdated ); + // Note that feed id should be permanent, immutable, and unique + // in order to support proper ETag creation. + // Tough to do when the feed is regenerated with each get. + feed.setId( "http://tuscany.apache.org/feed", true ); + + return feed; + } + + public Feed query(String queryString) { + Factory factory = Abdera.getNewFactory(); + Feed feed = factory.newFeed(); + feed.setTitle(feedTitle); + feed.setSubtitle(feedDescription); + Person author = factory.newAuthor(); + author.setName(feedAuthor); + feed.addAuthor(author); + feed.addLink("http://tuscany.apache.org", "alternate"); + + Feed allFeed = getFeed(); + if (queryString.startsWith("title=")) { + String title = queryString.substring(6); + + for (Entry entry: allFeed.getEntries()) { + if (entry.getTitle().contains(title)) { + feed.addEntry(entry); + } + } + } + return feed; + } + + public void delete(String id) throws NotFoundException { + } + + public Entry get(String id) throws NotFoundException { + return null; + } + + public Entry post(Entry entry) { + return null; + } + + public void put(String id, Entry entry) throws NotFoundException { + } + + /** + * Convert a ROME feed to an Abdera feed. + * + * @param romeFeed + * @return + */ + private static Feed atomFeed(SyndFeed syndFeed) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + + syndFeed.setFeedType("atom_1.0"); + SyndFeedOutput syndOutput = new SyndFeedOutput(); + try { + syndOutput.output(syndFeed, new OutputStreamWriter(bos)); + } catch (Exception e) { + throw new RuntimeException(e); + } + Parser parser = Abdera.getNewParser(); + Document document = parser.parse(new ByteArrayInputStream(bos.toByteArray())); + + return document.getRoot(); + } +} diff --git a/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/Sort.java b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/Sort.java new file mode 100644 index 0000000000..dec073c36b --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/Sort.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.util.List; + +import org.apache.abdera.model.Entry; + +/** + * The Sort service business interface. + * + * @version $Rev$ $Date$ + */ +public interface Sort { + + /** + * Sort feed entries by published date. + * @param entries + * @return + */ + List sort(List entries); +} diff --git a/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/SortImpl.java b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/SortImpl.java new file mode 100644 index 0000000000..354ef2d369 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/main/java/feed/SortImpl.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package feed; + +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; + +import org.apache.abdera.model.Entry; +import org.oasisopen.sca.annotation.Property; + +/** + * Implementation of a Feed Sort service component. + * + * @version $Rev$ $Date$ + */ +public class SortImpl implements Sort { + + @Property + public boolean newFirst = true; + + @SuppressWarnings("unchecked") + public List sort(List entries) { + Entry[] entriesArray = new Entry[entries.size()]; + entriesArray = (Entry[])entries.toArray(entriesArray); + Arrays.sort(entriesArray, new Comparator() { + public int compare(final Object xObj, final Object yObj) { + Date xDate = ((Entry)xObj).getUpdated(); + Date yDate = ((Entry)yObj).getUpdated(); + if (xDate == null) + return -1; + if (newFirst) + return yDate.compareTo(xDate); + else + return xDate.compareTo(yDate); + } + }); + return Arrays.asList(entriesArray); + } +} diff --git a/java/sca/contrib/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java b/java/sca/contrib/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java new file mode 100644 index 0000000000..1c549f7cd2 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LaunchFeedServer { + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite"); + + try { + System.out.println("Sample Feed server started (press enter to shutdown)"); + System.out.println(); + System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:"); + System.out.println("http://localhost:8083/atomAggregator"); + System.out.println("http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)"); + System.out.println("http://localhost:8083/rssAggregator"); + System.out.println(); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + + scaDomain.close(); + System.out.println("Sample Feed server stopped"); + } +} diff --git a/java/sca/contrib/samples/feed-aggregator/src/main/resources/FeedAggregator.composite b/java/sca/contrib/samples/feed-aggregator/src/main/resources/FeedAggregator.composite new file mode 100644 index 0000000000..8a3a53b4d5 --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/main/resources/FeedAggregator.composite @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + RSS Aggregator Sample + + + + true + + + + + + + + + + + + Atom Aggregator Sample + + + diff --git a/java/sca/contrib/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java b/java/sca/contrib/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java new file mode 100644 index 0000000000..9fdfe711be --- /dev/null +++ b/java/sca/contrib/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java @@ -0,0 +1,332 @@ +package feed; + +import java.io.IOException; +import java.io.Reader; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import junit.framework.Assert; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import org.apache.abdera.Abdera; +import org.apache.abdera.i18n.iri.IRI; +import org.apache.abdera.factory.Factory; +import org.apache.abdera.model.Base; +import org.apache.abdera.model.Content; +import org.apache.abdera.model.Entry; +import org.apache.abdera.model.Feed; +import org.apache.abdera.model.Document; +import org.apache.abdera.model.Collection; +import org.apache.abdera.protocol.Response.ResponseType; +import org.apache.abdera.protocol.client.AbderaClient; +import org.apache.abdera.protocol.client.ClientResponse; +import org.apache.abdera.protocol.client.RequestOptions; +import org.apache.abdera.util.EntityTag; +import org.apache.abdera.writer.Writer; +import org.apache.abdera.writer.WriterFactory; +import org.apache.abdera.parser.Parser; + +/** + * Tests use of server provided feed entity tags for Atom binding in Tuscany. + * Tests conditional gets (e.g. get if-none-match) or conditional posts (post if-match) + * using entity tags and last modified entries in headers. + * Uses the SCA provided Provider composite to act as a server. + * Uses the Abdera provided Client to act as a client. + */ +public class FeedAggregatorTest { + public final static String providerURI = "http://localhost:8083/atomAggregator"; + protected static SCADomain scaProviderDomain; + protected static Abdera abdera; + protected static AbderaClient client; + protected static Parser abderaParser; + protected static String eTag; + protected static Date lastModified; + protected static long contentLength; + protected static int numberEntries; + protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time + + @BeforeClass + public static void init() throws Exception { + try { + System.out.println(">>>FeedAggregatorTest.init"); + scaProviderDomain = SCADomain.newInstance("FeedAggregator.composite"); + abdera = new Abdera(); + client = new AbderaClient(abdera); + abderaParser = Abdera.getNewParser(); + } catch ( Throwable e ) { + System.out.println( e ); + e.printStackTrace(); + } + } + + @AfterClass + public static void destroy() throws Exception { + System.out.println(">>>FeedAggregatorTest.destroy"); + scaProviderDomain.close(); + } + + @Test + public void testPrelim() throws Exception { + Assert.assertNotNull(scaProviderDomain); + Assert.assertNotNull( client ); + } + + @Test + public void testFeedBasics() throws Exception { + System.out.println(">>>FeedAggregatorTest.testFeedBasics"); + RequestOptions opts = new RequestOptions(); + // Normal feed request + ClientResponse res = client.get(providerURI, opts); + Assert.assertNotNull(res); + try { + // Asser feed provided since no predicates + Assert.assertEquals(200, res.getStatus()); + Assert.assertEquals(ResponseType.SUCCESS, res.getType()); + // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res ); + + // Perform other tests on feed. + contentLength = getContentLength( res ); + System.out.println( "FeedAggregatorTest.testFeedBasics full contentLength=" + contentLength ); + + Document doc = res.getDocument(); + Assert.assertNotNull( doc ); + Feed feed = doc.getRoot(); + Assert.assertNotNull( feed ); + + // printFeed( "Feed values", " ", feed ); + // RFC 4287 requires non-null id, title, updated elements + Assert.assertNotNull( feed.getId() ); + Assert.assertNotNull( feed.getTitle() ); + Assert.assertNotNull( feed.getUpdated() ); + + eTag = res.getHeader("ETag"); + Assert.assertNotNull( eTag ); + lastModified = res.getLastModified(); + Assert.assertNotNull( lastModified ); + + numberEntries = getEntryCount( feed ); + System.out.println( "FeedAggregatorTest.testFeedBasics number entries=" + numberEntries ); + + // printFeed( "Aggregated Feed Contents:", " ", feed ); + // System.out.println( "FeedAggregatorTest.testFeedBasics feed=" + feed ); + // printResponseHeaders( "Aggregated Feed response headers:", " ", res ); + // System.out.println("Aggregated Feed response body:"); + // prettyPrint(abdera, res.getDocument()); + // printEntryUpdates( "Aggregated Feed feed updates", " ", feed ); + } finally { + res.release(); + } + } + + @Test + public void testUnmodifiedGetIfModified() throws Exception { + System.out.println(">>>FeedAggregatorTest.testFeedUnmodifiedGetIfModified"); + // Feed request with predicates + RequestOptions opts = new RequestOptions(); + final String contentType = "application/atom+xml"; + opts.setContentType(contentType); + opts.setHeader( "If-Modified-Since", dateFormat.format( new Date( 0 ) )); + + ClientResponse res = client.get(providerURI, opts); + Assert.assertNotNull(res); + try { + // Should return 200 - Feed provided since feed is changed. + Assert.assertEquals(200, res.getStatus()); + Assert.assertEquals(ResponseType.SUCCESS, res.getType()); + + String thisETag = res.getHeader("ETag"); + Assert.assertNotNull( thisETag ); + Date thisLastModified = res.getLastModified(); + Assert.assertNotNull( thisLastModified ); + + // Entry count and body size should be equal to basic request + long thisContentLength = getContentLength( res ); + + Document doc = res.getDocument(); + Assert.assertNotNull( doc ); + Feed feed = doc.getRoot(); + Assert.assertNotNull( feed ); + int thisNumberEntries = getEntryCount( feed ); + // System.out.println( "FeedAggregatorTest.UnmodifiedGetIfModified number entries=" + numberEntries + ", this number entries=" + thisNumberEntries ) ; + } finally { + res.release(); + } + } + + @Test + public void testUnmodifiedGetIfUnModified() throws Exception { + System.out.println(">>>FeedAggregatorTest.testFeedUnmodifiedGetIfUnModified"); + // Feed request with predicates + RequestOptions opts = new RequestOptions(); + final String contentType = "application/atom+xml"; + opts.setContentType(contentType); + opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date( 0 ) )); + + ClientResponse res = client.get(providerURI, opts); + Assert.assertNotNull(res); + try { + // Should return 304 - Feed not provided since feed is modified since. + Assert.assertEquals(304, res.getStatus()); + + // Entry count and body size should be equal to basic request + long thisContentLength = getContentLength( res ); + System.out.println( "FeedAggregatorTest.UnModifiedGetIfUnModified saved " + (contentLength - thisContentLength) + " bytes of network traffic due to caching."); + } finally { + res.release(); + } + } + + /** Print feed vital fields. */ + public static void printFeed( String title, String indent, Feed feed ) { + if ( feed == null ) { + System.out.println( title + " feed is null"); + return; + } + + System.out.println( title ); + System.out.println( indent + "id=" + feed.getId() ); + System.out.println( indent + "title=" + feed.getTitle() ); + System.out.println( indent + "updated=" + feed.getUpdated() ); + System.out.println( indent + "author=" + feed.getAuthor() ); + System.out.println( indent + "self link=" + feed.getSelfLink() ); + Collection collection = feed.getCollection(); + if ( collection == null ) { + System.out.println( indent + "collection=null" ); + } else { + System.out.println( indent + "collection=" + collection ); + } + } + + /* Print headers of request. */ + public static void printRequestHeaders( String title, String indent, RequestOptions request ) { + System.out.println( title ); + if ( request == null ) { + System.out.println( indent + " request is null"); + return; + } + String [] headerNames = request.getHeaderNames(); + for ( String headerName: headerNames) { + String header = request.getHeader(headerName); + System.out.println( indent + " header name,value=" + headerName + "," + header ); + } + } + + /* Print headers of response. */ + public static void printResponseHeaders( String title, String indent, ClientResponse response ) { + System.out.println( title ); + if ( response == null ) { + System.out.println( indent + " response is null"); + return; + } + String [] headerNames = response.getHeaderNames(); + for ( String headerName: headerNames) { + String header = response.getHeader(headerName); + System.out.println( indent + " header name,value=" + headerName + "," + header ); + } + + } + + /** Pretty print the document body. */ + public static void prettyPrint(Abdera abdera, Base doc) throws IOException { + WriterFactory factory = abdera.getWriterFactory(); + Writer writer = factory.getWriter("prettyxml"); + writer.writeTo(doc, System.out); + System.out.println(); + } + + /** Print the updated elements of the feed entries. */ + public static void printEntryUpdates( String title, String indent, Feed feed ) { + if ( feed == null ) { + System.out.println( title + " feed is null"); + return; + } + + System.out.println( title ); + List entries = feed.getEntries(); + if ( entries == null ) { + System.out.println( indent + " null entries"); + } + System.out.println( indent + "entries size=" + entries.size()); + + int i = 0; + for ( Entry entry: entries ) { + String entryTitle = entry.getTitle(); + if (( entryTitle != null ) && ( entryTitle.length() > 20 )) + entryTitle = entryTitle.substring( 0, 20 ); + // System.out.println( indent + i++ + ": title=\"" + entryTitle + + // "\", updated=" + entry.getUpdated() + ", published=" + entry.getPublished() ); + System.out.println( indent + i++ + ": title=\"" + entryTitle + + "\", updated=" + entry.getUpdated() ); + } + } + + /** Get the length of the response body content. */ + public static long getContentLength( ClientResponse response ) { + // getContentLenght returns -1 + // contentLength = response.getContentLength(); + try { + Reader reader = response.getReader(); + long actualSkip = reader.skip( Long.MAX_VALUE ); + return actualSkip; + } catch ( IOException e ) { + } + return -1L; + } + + /** Get a count of entries in the feed. */ + public static int getEntryCount( Feed feed ) { + if ( feed == null ) { + return 0; + } + + List entries = feed.getEntries(); + if ( entries == null ) { + return 0; + } + return entries.size(); + } + + /** Given a feed, determine the median point of the entries. + * Use the updated field of the entries to determine median. + * @param feed + * @return + */ + public static Date getUpdatedMedian( Feed feed ) { + Date sentinal = null; + if ( feed == null ) { + return sentinal; + } + + List entries = feed.getEntries(); + if ( entries == null ) { + return sentinal; + } + int size = entries.size(); + if( size == 0 ) { + return sentinal; + } + // System.out.println( "getUpdatedMedian entries size=" + entries.size()); + ArrayList updates = new ArrayList( size ); + + for ( Entry entry: entries ) { + Date entryUpdated = entry.getUpdated(); + if ( entryUpdated == null ) { + entryUpdated = new Date( 0 ); + } + updates.add( entryUpdated ); + } + Collections.sort( updates ); + // System.out.println( "getUpdatedMedian entry min update=" + updates.get( 0 )); + // System.out.println( "getUpdatedMedian entry max update=" + updates.get( size - 1 )); + Date median = updates.get( size/2 ); + // System.out.println( "getUpdatedMedian entry max median=" + median ); + return median; + } +} diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/README b/java/sca/contrib/samples/helloworld-bpel-ws/README new file mode 100644 index 0000000000..5c669f5da5 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/README @@ -0,0 +1,151 @@ +Hello World BPEL Webservices Sample +====================================== +This sample demonstrates an SCA service implemented by a BPEL process, made available as a Web service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory, and do + +ant compile run + +OR if you don't have ant, on Windows do + +mkdir target\classes +mkdir target\wsdl2java-source +java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl +java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl +unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database +javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java +copy src\main\resources\* target\classes +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient + +and on *nix do + +mkdir target/classes +mkdir target/wsdl2java-source +java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl +java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl +unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database +javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java +cp src/main/resources/* target/classes +java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient + +The sample will start an embedded BPEL engine, deploy a process and invoke it. + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +web service binding. + +helloworld-bpel/ + src/ + main/ + java/ + helloworld/ + BPELClient.java - client application for + BEPELHelloWorldComponent + + resources/ + deploy.xml - ODE deployment descriptor + helloworld.bpel - helloworld bpel process + helloworld.componentType - helloworld bpel service description + helloworld.composite - the SCA assembly for this sample + helloworld.wsdl - the service description that describes + the bpel process + log4j.properties - logging configuration + + test/ + java/ + helloworld/ + BPELHelloWorldTestCase.java - JUnit test case + helloworld-bpel.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- + +With the binary distribution the sample can be built and run using Ant as +follows + +cd helloworld-bpel +ant compile +ant run + + +You should see the following output from the run target. + +run: + [java] Starting BPELHelloWorldComponent + [java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes + [java] ::arg:::::: + [java] Hello + [java] ::message:: + [java] Hello + [java] Status: RESPONSE + [java] Response: + [java] Hello World + [java] Hello World + [java] Stopping BPELHelloWorldComponent + [java] Stopped !!! + +BUILD SUCCESSFUL +Total time: 36 seconds + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven, a simple test is present that exercise +the same logic as the client to invoke the BPEl process. + +cd helloworld-bpel +mvn + +You should see the following output from the test phase. + +- + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.BPELHelloWorldTestCase +Starting BPELHelloWorldComponent +>>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes +::arg:::::: +Hello +::message:: +Hello +Status: RESPONSE +Response: +Hello World +Stopping BPELHelloWorldComponent +Stopped !!! +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +[INFO] [jar:jar] +[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar +[INFO] [install:install] +[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend +e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESSFUL +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 53 seconds +[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008 +[INFO] Final Memory: 24M/43M +[INFO] ------------------------------------------------------------------------ + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/build.xml b/java/sca/contrib/samples/helloworld-bpel-ws/build.xml new file mode 100644 index 0000000000..c8917007f1 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/build.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.png b/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.png new file mode 100644 index 0000000000..5f53a3c5d1 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.png differ diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.svg b/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.svg new file mode 100644 index 0000000000..5a98f1a07c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/helloworld-bpel.svg @@ -0,0 +1,179 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + HelloWorldWebService + + implementation.bpel helloworld.bpel + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/pom.xml b/java/sca/contrib/samples/helloworld-bpel-ws/pom.xml new file mode 100644 index 0000000000..09cb2cbd53 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/pom.xml @@ -0,0 +1,205 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-bpel-ws + Apache Tuscany SCA HelloWorld BPEL as Webservice Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-ode + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1-incubating + + + + xerces + xercesImpl + 2.8.1 + + + + junit + junit + 4.2 + test + + + + org.apache.tuscany.sca + tuscany-wsdl2java + 2.0-SNAPSHOT + + + + org.apache.tuscany.sdo + tuscany-sdo-tools + 1.1-incubating + + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + runtime + + + + com.sun.xml.bind + jaxb-impl + 2.1.7 + compile + + + javax.xml.stream + stax-api + + + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1-incubating + + + generate-bpel-helloworld + generate-sources + + ${basedir}/src/main/resources/helloworld.wsdl + ${basedir}/target/wsdl2java-source + HelloWorld + true + true + true + + + generate + + + + + + org.apache.tuscany.sca + tuscany-maven-wsdl2java + 2.0-SNAPSHOT + + + + ${basedir}/src/main/resources/helloworld.wsdl + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java new file mode 100644 index 0000000000..971a5373e9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple BPEL sample application invoking a helloworld + * + * @version $Rev: 613905 $ $Date: 2008-01-21 14:41:15 +0000 (Mon, 21 Jan 2008) $ + */ +public class BPELClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("helloworld.composite"); + HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); + + String result = bpelService.hello("Hello"); + System.out.println(result); + + scaDomain.close(); + + System.exit(0); + } +} diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/deploy.xml b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/deploy.xml new file mode 100644 index 0000000000..d9d4363832 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/deploy.xml @@ -0,0 +1,31 @@ + + + + + + true + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel new file mode 100644 index 0000000000..a88aa7960c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + concat($tmpVar,' World') + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType new file mode 100644 index 0000000000..70273245d7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..97262109e6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..1cb338b283 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/log4j.properties b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/log4j.properties new file mode 100644 index 0000000000..c1bc0a0b81 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/main/resources/log4j.properties @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.sql=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.openjpa.kernel=OFF + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java b/java/sca/contrib/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java new file mode 100644 index 0000000000..6ad63f87d9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Tests the BPEL service + * + * @version $Rev: 636807 $ $Date: 2008-03-13 17:32:45 +0000 (Thu, 13 Mar 2008) $ + */ +public class BPELHelloWorldTestCase extends TestCase { + + private SCADomain scaDomain; + HelloPortType bpelService = null; + + /** + * @throws java.lang.Exception + */ + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("helloworld.composite"); + bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); + + } + + /** + * @throws java.lang.Exception + */ + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testInvoke() throws Exception { + String response = bpelService.hello("Hello"); + assertEquals("Hello World", response); + } +} diff --git a/java/sca/contrib/samples/helloworld-bpel/README b/java/sca/contrib/samples/helloworld-bpel/README new file mode 100644 index 0000000000..bf5f500ef3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/README @@ -0,0 +1,151 @@ +Hello World BPEL Sample +====================================== +This sample demonstrates an SCA service implemented by a BPEL process. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory, and do + +ant compile run + +OR if you don't have ant, on Windows do + +mkdir target\classes +mkdir target\wsdl2java-source +java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl +java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl +unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database +javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java +copy src\main\resources\* target\classes +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient + +and on *nix do + +mkdir target/classes +mkdir target/wsdl2java-source +java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl +java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl +unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database +javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java +cp src/main/resources/* target/classes +java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient + +The sample will start an embedded BPEL engine, deploy a process and invoke it. + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +web service binding. + +helloworld-bpel/ + src/ + main/ + java/ + helloworld/ + BPELClient.java - client application for + BEPELHelloWorldComponent + + resources/ + deploy.xml - ODE deployment descriptor + helloworld.bpel - helloworld bpel process + helloworld.componentType - helloworld bpel service description + helloworld.composite - the SCA assembly for this sample + helloworld.wsdl - the service description that describes + the bpel process + log4j.properties - logging configuration + + test/ + java/ + helloworld/ + BPELHelloWorldTestCase.java - JUnit test case + helloworld-bpel.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- + +With the binary distribution the sample can be built and run using Ant as +follows + +cd helloworld-bpel +ant compile +ant run + + +You should see the following output from the run target. + +run: + [java] Starting BPELHelloWorldComponent + [java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes + [java] ::arg:::::: + [java] Hello + [java] ::message:: + [java] Hello + [java] Status: RESPONSE + [java] Response: + [java] Hello World + [java] Hello World + [java] Stopping BPELHelloWorldComponent + [java] Stopped !!! + +BUILD SUCCESSFUL +Total time: 36 seconds + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven, a simple test is present that exercise +the same logic as the client to invoke the BPEl process. + +cd helloworld-bpel +mvn + +You should see the following output from the test phase. + +- + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.BPELHelloWorldTestCase +Starting BPELHelloWorldComponent +>>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes +::arg:::::: +Hello +::message:: +Hello +Status: RESPONSE +Response: +Hello World +Stopping BPELHelloWorldComponent +Stopped !!! +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +[INFO] [jar:jar] +[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar +[INFO] [install:install] +[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend +e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESSFUL +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 53 seconds +[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008 +[INFO] Final Memory: 24M/43M +[INFO] ------------------------------------------------------------------------ + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-bpel/build.xml b/java/sca/contrib/samples/helloworld-bpel/build.xml new file mode 100644 index 0000000000..890a6427b8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/build.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.png b/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.png new file mode 100644 index 0000000000..5f53a3c5d1 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.png differ diff --git a/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.svg b/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.svg new file mode 100644 index 0000000000..5a98f1a07c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/helloworld-bpel.svg @@ -0,0 +1,179 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + HelloWorldWebService + + implementation.bpel helloworld.bpel + + diff --git a/java/sca/contrib/samples/helloworld-bpel/pom.xml b/java/sca/contrib/samples/helloworld-bpel/pom.xml new file mode 100644 index 0000000000..d93676d77d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/pom.xml @@ -0,0 +1,198 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-bpel + Apache Tuscany SCA HelloWorld BPEL Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-ode + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1.1 + + + + xerces + xercesImpl + 2.8.1 + + + + junit + junit + 4.5 + test + + + + org.apache.tuscany.sca + tuscany-wsdl2java + 2.0-SNAPSHOT + + + + org.apache.tuscany.sdo + tuscany-sdo-tools + 1.1.1 + + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + runtime + + + + javax.xml.bind + jaxb-api + 2.1 + compile + + + javax.xml.stream + stax-api + + + + + + com.sun.xml.bind + jaxb-impl + 2.1.7 + runtime + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1.1 + + + generate-bpel-helloworld + generate-sources + + ${basedir}/src/main/resources/helloworld.wsdl + ${basedir}/target/wsdl2java-source + HelloWorld + true + true + true + + + generate + + + + + + org.apache.tuscany.sca + tuscany-maven-wsdl2java + 2.0-SNAPSHOT + + + + ${basedir}/src/main/resources/helloworld.wsdl + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java b/java/sca/contrib/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java new file mode 100644 index 0000000000..1826c885c4 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple BPEL sample application invoking a helloworld + * + * @version $Rev$ $Date$ + */ +public class BPELClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("helloworld.composite"); + HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); + + String result = bpelService.hello("Hello"); + System.out.println(result); + + scaDomain.close(); + + System.exit(0); + } +} diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/deploy.xml b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/deploy.xml new file mode 100644 index 0000000000..9bd95b2c58 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/deploy.xml @@ -0,0 +1,31 @@ + + + + + + true + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.bpel b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.bpel new file mode 100644 index 0000000000..a88aa7960c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.bpel @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + concat($tmpVar,' World') + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.componentType b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.componentType new file mode 100644 index 0000000000..2b360111cb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.composite b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.composite new file mode 100644 index 0000000000..b4623b5c2d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.composite @@ -0,0 +1,29 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.wsdl b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.wsdl new file mode 100644 index 0000000000..46cf381577 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/helloworld.wsdl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel/src/main/resources/log4j.properties b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/log4j.properties new file mode 100644 index 0000000000..8649a71550 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/main/resources/log4j.properties @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.sql=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=OFF +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.openjpa.kernel=OFF + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java b/java/sca/contrib/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java new file mode 100644 index 0000000000..1caaa78878 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Tests the BPEL service + * + * @version $Rev$ $Date$ + */ +public class BPELHelloWorldTestCase extends TestCase { + + private SCADomain scaDomain; + HelloPortType bpelService = null; + + /** + * @throws java.lang.Exception + */ + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("helloworld.composite"); + bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); + + } + + /** + * @throws java.lang.Exception + */ + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testInvoke() throws Exception { + String response = bpelService.hello("Hello"); + assertEquals("Hello World", response); + } +} diff --git a/java/sca/contrib/samples/helloworld-distributed/README b/java/sca/contrib/samples/helloworld-distributed/README new file mode 100644 index 0000000000..9462ae4218 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/README @@ -0,0 +1,29 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar + +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-node/README b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/README new file mode 100644 index 0000000000..9462ae4218 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/README @@ -0,0 +1,29 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar + +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-node/pom.xml b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/pom.xml new file mode 100644 index 0000000000..1cdedf7d15 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/pom.xml @@ -0,0 +1,57 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-node + Apache Tuscany SCA Helloworld Node Sample + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-dynamic + 2.0-SNAPSHOT + test + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..e2b7c698ac --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java new file mode 100644 index 0000000000..033b4088c8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +public class HelloworldImpl implements Helloworld { + + public String sayHello(String name) { + System.out.println("HelloworldImpl.sayHello: " + name); + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite new file mode 100644 index 0000000000..0f827390c8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/README b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/README new file mode 100644 index 0000000000..9462ae4218 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/README @@ -0,0 +1,29 @@ +Distributed Helloworld Sample +============================= + +This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which +automatically discovers available nodes and the services they contain. + +In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, +and a webapp using a JSP with which invokes the Helloworld service in the domain. + +To run the sample: + +- Build the two sample modules with mvn or Ant. +- Deploy the helloworld-webapp war to Tomcat. +- Start the standalone node by: + in the helloworld-node folder do "mvn dependency:copy-dependencies" then: + java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar + +- On a web browser go to: + http://localhost:8080/sample-helloworld-webapp + +You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" + +How it works: + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/build.xml b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/build.xml new file mode 100644 index 0000000000..ef49524e39 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/build.xml @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/pom.xml b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/pom.xml new file mode 100644 index 0000000000..b298c4eb62 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/pom.xml @@ -0,0 +1,78 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-webapp + war + Apache Tuscany SCA Distributed Helloworld WebApp Sample + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca-jms + 2.0-SNAPSHOT + runtime + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java new file mode 100644 index 0000000000..04918244f0 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Helloworld { + + String sayHello(String name); +} diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..0e8de1be42 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1eefec1c48 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Distributed Helloworld Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.jsp + + + diff --git a/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..873329cf7c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp @@ -0,0 +1,36 @@ + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> + + + + + + +

Apache Tuscany Distributed Helloworld Sample

+ + Calling service.sayHello("world") returns: + +

+ + <%= service.sayHello("world") %> + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/README b/java/sca/contrib/samples/helloworld-dojo-webapp/README new file mode 100644 index 0000000000..38392a13b6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/README @@ -0,0 +1,104 @@ +Hello World Dojo RPC Sample +=========================== + +Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 + +This sample demostrates the SCA JSONRPC binding using a simple web app that +uses the RPC support of the Dojo Toolkit to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding +but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be +used to invoke the SCA service. + +The web app provided shows how the service can be called by using the DOJO toolkit. + +helloworld-dojo-webapp/ + build-dojo.xml - This file is an Ant script used by the + sample build process to download the Dojo Toolkit + and get it included in the WAR file + for use by the sample. + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + dojo/ - the Dojo toolkit (this directory is created only + when you build the samples from the source distribution) + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-dojo-webapp +ant package + +This should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-dojo-webapp +mvn + +Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/build-dojo.xml b/java/sca/contrib/samples/helloworld-dojo-webapp/build-dojo.xml new file mode 100644 index 0000000000..534a1dacd9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/build.xml b/java/sca/contrib/samples/helloworld-dojo-webapp/build.xml new file mode 100644 index 0000000000..95813af65a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/build.xml @@ -0,0 +1,70 @@ + + +]> + + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png b/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png differ diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg b/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg new file mode 100644 index 0000000000..d5c3bc5d3e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/pom.xml b/java/sca/contrib/samples/helloworld-dojo-webapp/pom.xml new file mode 100644 index 0000000000..d839ecddc6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/pom.xml @@ -0,0 +1,163 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-dojo-webapp + war + Apache Tuscany SCA HelloWorld DOJO Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + true + + + generate + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..3d8ea24f04 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..b4997ba907 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +import java.util.Date; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return new Date() + ": [JSONRPC] Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite new file mode 100644 index 0000000000..e895ab455d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..4195f3288c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,98 @@ + + + +Tuscany JSON-RPC HelloWorld Example + + + + + + + + + + + + + +

Tuscany Dojo JSON-RPC HelloWorld Sample

+ +
+ + + + + + + + + + + + + + + + +
Dojo Example
+

This example uses the Dojo + Toolkit to create a JavaScript object helloWorldService + for the SCA service 'HelloWorldService' using Dojo's + RPC classes and providing them with HelloWorldService?smd + for Simple Method Description + (SMD) input.

+

It then creates a Dojo button that will envoke the getGreetings + method of the HelloWorldService object.

+
RequestResponse

+ +
+
None Yet.
+
+
Dojo Debug:
+
+ + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..2c178c1ddc --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..70cd67890a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany DOJO HelloWorld Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + HelloWorldJSONRPC.html + + + diff --git a/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/style.css b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-dojo-webapp/src/main/webapp/style.css @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/README b/java/sca/contrib/samples/helloworld-jms-webapp/README new file mode 100644 index 0000000000..9be2e0b0f6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/README @@ -0,0 +1,130 @@ +JMS HelloWorld Sample +===================== +This sample demonstrates a simple webapp containing a hello world style client +and service using the JMS binding for request-response style messaging. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-jms-webapp.war ) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-jms-webapp/ + +The port and hostname will of course vary depending on your local installation. + +Configuring the JMS resources +----------------------------- + +The sample requires JMS resources be manually configured in the server environment, these are: + +- a JMS connection factory named "ConnectionFactory" +- a JMS queue named "HelloWorldService" + +See the following for how to define these resources depending on the application server being used: + +Tuscany with embedded ActiveMQ broker +------------------------------------- + + +Apache Tomcat +------------- + +No configuration is necessary for Tomcat as the sample WAR includes everything pre-configured to run +an ActiveMQ embedded JMS broker and to configure the JMS resources in JNDI. + +The JNDI resources are configured in the META-INF/comtext.xml file, for more information on running +ActiveMQ in Tomcat see: http://activemq.apache.org/tomcat.html + + +Apache Geronimo +--------------- + +For Apache Geronimo 2.0.1 (2.0.2 fails to define JMS resources for me) + +Logon to the Geronimo Server Console (http://localhost:8080/console, uid system, pswd manager) + +In the Console Navigation on the left under Services click JMS Resources + +At the bottom of the JMS Resources panel click under Create a new JMS Resource Group click For ActiveMQ + +In Resource Group Name enter "MyRGN" and click next + +At JMS Resource Group click Add Connection Factory + +For JMS Factory Type choose javax.jms.ConnectionFactory and click Next + +In Connection Factory Name enter "ConnectionFactory" and click Next + +Click Add destination + +For JMS Destination Type choose javax.jms.Queue and click Next + +Enter "HelloWorldService" for both Message Destination Name and PhysicalName and click Next + +Click Deploy Now + +Thats it, you're done. + + +WebSphere +--------- + +To define the JMS resources in a new WebSphere Application Server 6.1 installation: + +1) First define a Service integration bus: + +Logon to the WebSphere Integrated Solutions Console (http://localhost:9060/ibm/console) + +On the Left hand menu expand Service integration, and click on Buses. + +In the Buses panel click on New + +Enter a name for the bus, eg MyBus, and click Next, and then click Finish and Save the changes. + +In the Buses panel click on MyBus + +Find the Topology secion and click on Bus members + +Click on Add, leave the defaults and click Next, Next, Next, Finish, and Save the changes. + +Restart WebSphere and when back up logon back on to the Integrated Solutions Console + +2) Now define the JMS rescources + +On the Left hand menu expand Resources, and JMS and click on Connection Facotories. + +In the Connection factories panel click New. + +Leave the Default messaging provider and click OK + +Enter "ConnectionFactory" in the Name and JNDI name and in the Bus name in the Connection pane choose MyBus and click OK + +On the Left hand menu in JMS click on Queues + +In the Queues panel click New, accept the defaults and click OK + +Enter "HelloWorldService" for the Name and JNDI name and in the Bus name in the Connection pane choose MyBus, +and then in the Queue name drop down list choose "Create SIB destination" + +In the Set queue attributes panel enter "HelloWorldService" for the Identifier and click Next, Next, and Finish + +That should take you back to the Queues panel where you can click OK to create the new JMS queue. + +Save the changes + +Restart WebSphere and you're done. + + + +Others... +--------- + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/pom.xml b/java/sca/contrib/samples/helloworld-jms-webapp/pom.xml new file mode 100644 index 0000000000..c2d6155233 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-jms-webapp + war + Apache Tuscany SCA JMS HelloWorld Sample in a WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + ${pom.groupId} + tuscany-host-webapp + ${pom.version} + + + + ${pom.groupId} + tuscany-binding-jms-runtime + ${pom.version} + + + + ${pom.groupId} + tuscany-implementation-java-runtime + ${pom.version} + + + + org.apache.activemq + activemq-core + 5.1.0 + runtime + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..c24a741ee2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld client implementation + */ +public class HelloWorldClient implements HelloWorldService { + + HelloWorldService helloWorldRef; + + public String sayHello(String name) { + System.out.println("HelloWorldClient.sayHello " + name); + return helloWorldRef.sayHello(name); + } + + public void setHelloWorldRef(HelloWorldService helloWorldRef) { + System.out.println("HelloWorldClient .setHelloWorldService " + helloWorldRef); + this.helloWorldRef = helloWorldRef; + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..17f997f60d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String sayHello(String name); +} diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..47756f46aa --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceImpl implements HelloWorldService { + + public String sayHello(String name) { + System.out.println("HelloWorldServiceImpl .sayHello " + name); + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000000..2419887413 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite new file mode 100644 index 0000000000..f6328d156c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..86710435ae --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,66 @@ + + + + + + + Apache Tuscany JMS Web Service Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.jsp + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..bc6ef59a9b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp @@ -0,0 +1,44 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> +<%@ page import="helloworld.HelloWorldService" %> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + HelloWorldService helloWorldService = (HelloWorldService)scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); +%> + +HelloWorld JMS sample + + + +If this sample is working correctly you should see "Hello World" on the next line... +

+<%= helloWorldService.sayHello("world") %> +

+If you do not see "Hello World" on the line above then there has been a problem. +

+The sample requires JMS resources be manually configured in the server environment, these are: +a JMS connection factory named "ConnectionFactory", and a destination queues named "HelloWorldService". +See the sample README file for more information. + + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/README b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/README new file mode 100644 index 0000000000..07253d039b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/README @@ -0,0 +1,90 @@ +Hello World JSONRPC Sample +========================== +This sample demostrates the JSONRPC binding using a simple web app that +talks JSONRPC to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-jsonrpc-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-jsonrpc-webapp + +The port and hostname will of course vary depending on your local installation. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the SCA-provided JSON client can be +used to invoke the SCA service. + +helloworld-jsonrpc-webapp/ + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-jsonrpc-webapp +ant package + +This should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-jsonrpc-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-jsonrpc-webapp +mvn + +Again this should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png differ diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg new file mode 100644 index 0000000000..6ef1f438fb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/pom.xml b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/pom.xml new file mode 100644 index 0000000000..9d3b27d8cc --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/pom.xml @@ -0,0 +1,103 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-jsonrpc-webapp + war + Apache Tuscany SCA HelloWorld JSON-RPC Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java new file mode 100644 index 0000000000..3d8ea24f04 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +/** + * This is the business interface of the HelloWorld service component. + */ +public interface HelloWorldService { + + String getGreetings(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java new file mode 100644 index 0000000000..2234e21439 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworldjsonrpc; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service component. + */ +@Service(HelloWorldService.class) +public class HelloWorldServiceImpl implements HelloWorldService { + + /* + * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() + */ + public String getGreetings(String name) { + return "jsonrpcHello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite new file mode 100644 index 0000000000..e895ab455d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html new file mode 100644 index 0000000000..75dd9050fa --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html @@ -0,0 +1,75 @@ + + + + Tuscany JSON-RPC HelloWorld Example + + + + + + + + + + +

Tuscany JSON-RPC HelloWorld Sample

+ + + + + + + + + + + + + + + +
Non-Dojo Example
+ This example uses the JavaScript served from + SCADomain/scaDomain.js + to make JSON-RPC requests to the SCA service 'HelloWorldService' +
RequestResponse
+

+ Name please:     + + +

+ +
+
None Yet.
+
+ + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c8246e15a7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..267bed176c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany JSON-RPC HelloWorld Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + HelloWorldJSONRPC.html + + + diff --git a/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } diff --git a/java/sca/contrib/samples/helloworld-jsp/pom.xml b/java/sca/contrib/samples/helloworld-jsp/pom.xml new file mode 100644 index 0000000000..c2604065ca --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-jsp + war + Apache Tuscany SCA Helloworld JSP Sample + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 2.0-SNAPSHOT + runtime + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java b/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..2b92fd4661 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java @@ -0,0 +1,7 @@ +package sample; + +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..2664e75188 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java @@ -0,0 +1,12 @@ +package sample; + +import org.oasisopen.sca.annotation.Service; + +@Service(HelloworldService.class) +public class HelloworldServiceImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..16bc08fc10 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..46285614da --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ + + + + + + Apache Tuscany Helloworld JSP Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.jsp + + + diff --git a/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/hello.jsp b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/hello.jsp new file mode 100644 index 0000000000..beac8e457f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-jsp/src/main/webapp/hello.jsp @@ -0,0 +1,36 @@ + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> + + + + + + +

Apache Tuscany Helloworld JSP Sample

+ + Calling HelloworldService sayHello("world") returns: + +

+ + <%= service.sayHello("world") %> + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/README b/java/sca/contrib/samples/helloworld-reference-jms/README new file mode 100644 index 0000000000..184e67a239 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/README @@ -0,0 +1,114 @@ +Hello World JMS References Sample +================================= +This sample demonstrates an SCA reference that uses a JMS binding + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens you need to run the server first +so open a command prompt, navigate to the helloworld-service-jms sample directory +and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-service-jms.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-service-jms.jar helloworld.HelloWorldServer + + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-reference-jms.jar helloworld.HelloWorldJmsClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-reference-jms.jar helloworld.HelloWorldJmsClient + + +Sample Overview +--------------- +The sample provides a component that has a reference with a JMS binding. +The binding refers to JMS queue and communicates with a service +exposed by the helloworld-service-jms sample. + +helloworld-reference-jms/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldJmsClient.java - starts the SCA Runtime and + deploys the helloworldwsjmsclient + .composite. It then calls the + HelloWorldServiceComponent + resources/ + helloworldjmsclient.composite - the SCA assembly for this sample + helloworldjms.composite - the SCA assembly for the server + that is used by the JUnit tests + logging.properties - log4j configuration file + test/ + java/ + helloworld/ + HelloWorldJMSClientTestCase.java - JUnit test case + helloworld-reference.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. Before +you do this start up the service that the reference will talk to. To do this +run up the helloworld-service-jms test. Take a look at the README in that sample +and you will see you need the following commands + +cd helloworld-service-jms +ant run + +Once done you can now compile and run this sample using the following commands; + +cd helloworld-reference-jms +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +service-jms sample first as the JUnit test does this for you. + +cd helloworld-reference-jms +mvn + +You should see the following output from the test phase. + +run: + [java] Injected helloWorldService + [java] Called getGreetings + [java] javax.naming.NameNotFoundException: RequestQueue + ... + [java] Hello World + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-reference-jms/build.xml b/java/sca/contrib/samples/helloworld-reference-jms/build.xml new file mode 100644 index 0000000000..4702beed0d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.png b/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.png new file mode 100644 index 0000000000..ab80b1f91c Binary files /dev/null and b/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.png differ diff --git a/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.svg b/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.svg new file mode 100644 index 0000000000..40f4e8f271 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/helloworld-reference.svg @@ -0,0 +1,144 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjmsreference + + HelloWorldServiceComponent + + HelloWorldService ReferenceJMS + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/pom.xml b/java/sca/contrib/samples/helloworld-reference-jms/pom.xml new file mode 100644 index 0000000000..77d887509c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-reference-jms + Apache Tuscany SCA HelloWorld Reference JMS Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-helloworld-service-jms + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + org.apache.activemq + apache-activemq + 4.1.1 + test + + + org.apache.activemq + activemq-web-demo + + + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..2186c00e57 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java new file mode 100644 index 0000000000..5bec27a137 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldJmsClient { + + public final static void main(String[] args) throws Exception { + //SCANode node = SCANodeFactory.createNodeWithComposite("helloworldjmsreference.composite"); + //HelloWorldService helloWorldService = node.getDomain().getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + SCADomain scaDomain = SCADomain.newInstance("helloworldjmsreference.composite"); + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..ca7c90f23e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..27cef47677 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + System.out.println("Called getGreetings"); + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + System.out.println("Got Injected helloWorldService"); + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + System.out.println("Injected helloWorldService"); + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite new file mode 100644 index 0000000000..3cf1104562 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite new file mode 100644 index 0000000000..e692ef8e4c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/logging.properties new file mode 100644 index 0000000000..a2a4067921 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev: 582827 $ $Date: 2007-10-08 15:01:31 +0100 (Mon, 08 Oct 2007) $ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..e0ea596dd3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/java/sca/contrib/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java new file mode 100644 index 0000000000..f5380d9ccd --- /dev/null +++ b/java/sca/contrib/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * Test case for helloworld web service client + */ +public class HelloWorldJmsClientTestCase { + + private HelloWorldService helloWorldService; + private HelloWorldService helloTuscanyService; + private SCADomain scaClientDomain; + private SCADomain scaServiceDomain; + private BrokerService jmsBroker; + + + @Before + public void startClient() throws Exception { + try { + startBroker(); + scaServiceDomain = SCADomain.newInstance("helloworldjmsservice.composite"); + scaClientDomain = SCADomain.newInstance("helloworldjmsreference.composite"); + helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + Thread.sleep(2000); + } + + + @After + public void stopClient() throws Exception { + scaServiceDomain.close(); + scaClientDomain.close(); + if (jmsBroker != null) { + jmsBroker.stop(); + } + } + + protected void startBroker() throws Exception { + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + } +} diff --git a/java/sca/contrib/samples/helloworld-service-jms/README b/java/sca/contrib/samples/helloworld-service-jms/README new file mode 100644 index 0000000000..49feabaa07 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/README @@ -0,0 +1,101 @@ +Hello World JMS Service Sample +============================== +This sample demonstrates an SCA service that uses a JMS binding + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-service-jms.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-service-jms.jar helloworld.HelloWorldServer + +Now the server is started you can use the helloworld-reference-jms sample to +exercise it. + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +JMS binding. + +helloworld-service-jms/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldImpl.java - component implementation + HelloWorldServer.java - starts the SCA Runtime and + deploys the helloworldjmsservice + .composite and then waits for the + service to be called via JMS + resources/ + helloworldjmsservice.composite - the SCA assembly for this sample + + test/ + java/ + helloworld/ + HelloWorldJMSServerTestCase.java- JUnit test case + helloworld-service.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd helloworld-service-jms +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] HelloWorld server started (press enter to shutdown) + +As this point the SCA service is exposed as a JMS service via ActiveMQ which is +started automatically by the SCA runtime. To stop the server just press +enter. + +To exercise the service run up the helloworld-reference-jms sample. Take a look at +the README in that sample and you will see you need the following commands + +cd helloworld-reference-jms +ant run + +Building Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built +using Maven as follows. + +cd helloworld-service-jms +mvn + +You should see the following output + +... +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESSFUL +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 15 seconds +[INFO] Finished at: Wed Jul 02 12:50:24 BST 2008 +[INFO] Final Memory: 13M/51M +[INFO] ------------------------------------------------------------------------ + + +This shows that the module has compiled successfully. diff --git a/java/sca/contrib/samples/helloworld-service-jms/build.xml b/java/sca/contrib/samples/helloworld-service-jms/build.xml new file mode 100644 index 0000000000..330de7f7e5 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.png b/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.png new file mode 100644 index 0000000000..ef27c71f54 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.png differ diff --git a/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.svg b/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.svg new file mode 100644 index 0000000000..dd7a9dd87d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/helloworld-service.svg @@ -0,0 +1,139 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworld + + HelloWorldServiceComponent + HelloWorldServiceJMS + diff --git a/java/sca/contrib/samples/helloworld-service-jms/pom.xml b/java/sca/contrib/samples/helloworld-service-jms/pom.xml new file mode 100644 index 0000000000..c2be08fa75 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-service-jms + Apache Tuscany SCA HelloWorld Service JMS Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + org.apache.activemq + apache-activemq + 4.1.1 + + + org.apache.activemq + activemq-web-demo + + + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..2186c00e57 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..d4ea391a00 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + try { + BrokerService jmsBroker; + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + + SCADomain scaDomain = SCADomain.newInstance("helloworldjmsservice.composite"); + + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + + scaDomain.close(); + + jmsBroker.stop(); + System.out.println("HelloWorld server stopped"); + + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..a0081be22d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/definitions.xml b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/definitions.xml new file mode 100644 index 0000000000..8c881ab0bb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/definitions.xml @@ -0,0 +1,66 @@ + + + + + + + The general intent that a transport is available over which SOAP messages flow + + + + + + A JMS transport is required + + + + + + An HTTP transport is required + + + + + + + An HTTPS transport is required + + + + + + + org.apache.activemq.jndi.ActiveMQInitialContextFactory + tcp://localhost:61619 + QueueConnectionFactory + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite new file mode 100644 index 0000000000..3135cdc320 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..3f9e00689e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java b/java/sca/contrib/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java new file mode 100644 index 0000000000..7930f98716 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldJmsServerTestCaseOff { + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + // ActiveMQModuleActivator.startBroker(); + scaDomain = SCADomain.newInstance("helloworldjmsservice.composite"); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = + scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + } + +} diff --git a/java/sca/contrib/samples/helloworld-servlet/pom.xml b/java/sca/contrib/samples/helloworld-servlet/pom.xml new file mode 100644 index 0000000000..26fa4e62d2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/pom.xml @@ -0,0 +1,61 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-servlet + war + Apache Tuscany SCA Helloworld Sample using a servlet + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 2.0-SNAPSHOT + runtime + + + + javax.servlet + servlet-api + 2.3 + provided + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..2b92fd4661 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java @@ -0,0 +1,7 @@ +package sample; + +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..2664e75188 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java @@ -0,0 +1,12 @@ +package sample; + +import org.oasisopen.sca.annotation.Service; + +@Service(HelloworldService.class) +public class HelloworldServiceImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java new file mode 100644 index 0000000000..6b8af48161 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package sample; + +import java.io.IOException; +import java.io.Writer; + +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.oasisopen.sca.ComponentContext; +import org.oasisopen.sca.annotation.Reference; + +/** + */ +public class HelloworldServlet extends HttpServlet { + private static final long serialVersionUID = 1L; + + @Reference + protected HelloworldService service; + + @Override + public void init(ServletConfig config) { + if (service == null) { + // The helloworldService 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 cc = (ComponentContext)config.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext"); + service = cc.getService(HelloworldService.class, "service"); + } + } + + @Override + protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { + + String name = request.getParameter("name"); + String greeting = service.sayHello(name); + + Writer out = response.getWriter(); + out.write("Apache Tuscany Helloworld Servlet Sample"); + out.write("

Apache Tuscany Helloworld Servlet Sample

"); + out.write("
Result: " + greeting); + out.write(""); + out.flush(); + out.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..23fd33a408 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..28cfdd3f6c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,52 @@ + + + + + + Apache Tuscany Helloworld Servlet Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + HelloworldServlet + sample.HelloworldServlet + + + + HelloworldServlet + /HelloworldServlet + + + + hello.html + + + diff --git a/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/hello.html b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/hello.html new file mode 100644 index 0000000000..c4484916aa --- /dev/null +++ b/java/sca/contrib/samples/helloworld-servlet/src/main/webapp/hello.html @@ -0,0 +1,46 @@ + + + + +Apache Tuscany Helloworld Servlet Sample + + + + +

Apache Tuscany Helloworld Servlet Sample

+ +
+ + + + + + + + +
Enter your name: + +
+ +
+
+ + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-web-callback/pom.xml b/java/sca/contrib/samples/helloworld-web-callback/pom.xml new file mode 100644 index 0000000000..4a15d1a8ea --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-web-callback + war + Apache Tuscany SCA Web 2.0 Callbacks Sample + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-dwr + 2.0-SNAPSHOT + runtime + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java new file mode 100644 index 0000000000..2ee8e97e51 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface HelloworldCallback { + + @OneWay + void sayHelloCallback(String reply); +} diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..9c1e645776 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java @@ -0,0 +1,14 @@ +package sample; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +@Callback(HelloworldCallback.class) +public interface HelloworldService { + + @OneWay + void sayHello(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..5601bcd990 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java @@ -0,0 +1,27 @@ +package sample; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Service; + +@Service(HelloworldService.class) +public class HelloworldServiceImpl implements HelloworldService { + + @Callback + public HelloworldCallback callback; + + public void sayHello(final String name) { + Thread t = new Thread(new Runnable() { + public void run() { + for (int i=0; i<5; i++) { + callback.sayHelloCallback(i + "Hello " + name); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + }}); + t.start(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..fdd5a95f58 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f29262a147 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ + + + + + + Apache Tuscany Helloworld Servlet Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.html + + + diff --git a/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/hello.html b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/hello.html new file mode 100644 index 0000000000..a52cd5d59e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web-callback/src/main/webapp/hello.html @@ -0,0 +1,63 @@ + + + + + Apache Tuscany Helloworld Web2.0 Callbacks Sample + + + + + + + +

Apache Tuscany Helloworld Web2.0 Callbacks Sample

+ + + + + + + + + + + + +
Enter your name: + +
+ +
+
+
+ + + diff --git a/java/sca/contrib/samples/helloworld-web/pom.xml b/java/sca/contrib/samples/helloworld-web/pom.xml new file mode 100644 index 0000000000..48160e795a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/pom.xml @@ -0,0 +1,68 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-web + war + Apache Tuscany SCA Helloworld Web Sample + + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-web-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldService.java b/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldService.java new file mode 100644 index 0000000000..2b92fd4661 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldService.java @@ -0,0 +1,7 @@ +package sample; + +public interface HelloworldService { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java new file mode 100644 index 0000000000..2664e75188 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java @@ -0,0 +1,12 @@ +package sample; + +import org.oasisopen.sca.annotation.Service; + +@Service(HelloworldService.class) +public class HelloworldServiceImpl implements HelloworldService { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/contrib/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite new file mode 100644 index 0000000000..20cebc2d53 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..f29262a147 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,42 @@ + + + + + + Apache Tuscany Helloworld Servlet Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + hello.html + + + diff --git a/java/sca/contrib/samples/helloworld-web/src/main/webapp/hello.html b/java/sca/contrib/samples/helloworld-web/src/main/webapp/hello.html new file mode 100644 index 0000000000..f7f8b2d4a9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-web/src/main/webapp/hello.html @@ -0,0 +1,62 @@ + + + + + Apache Tuscany Helloworld Web Sample + + + + + + + +

Apache Tuscany Helloworld Web Sample

+ + + + + + + + + + + + +
Enter your name: + +
+ +
+
+
+ + + diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/README b/java/sca/contrib/samples/helloworld-ws-deep-webapp/README new file mode 100644 index 0000000000..66040004f8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/README @@ -0,0 +1 @@ +http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/build.xml b/java/sca/contrib/samples/helloworld-ws-deep-webapp/build.xml new file mode 100644 index 0000000000..bdb341d26a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/build.xml @@ -0,0 +1,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/pom.xml b/java/sca/contrib/samples/helloworld-ws-deep-webapp/pom.xml new file mode 100644 index 0000000000..0595f43ec2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/pom.xml @@ -0,0 +1,45 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + + + sample-helloworld-ws-service-webapp + Apache Tuscany SCA HelloWorld Web Service Sample Webapp + war + + + + org.apache.tuscany.sca + tuscany-sca-api + 2.0-SNAPSHOT + provided + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..a75187f0d7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..18f74b083f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite new file mode 100644 index 0000000000..114608e4d8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..182fd38fd9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,27 @@ + + + + + + + Apache Tuscany HelloWorld Web Service Sample + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/README b/java/sca/contrib/samples/helloworld-ws-reference-jms/README new file mode 100644 index 0000000000..abf10ef1f2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/README @@ -0,0 +1,127 @@ +Hello World Web Service References Sample +========================================= +This sample demonstrates an SCA reference that uses a web service binding running +over a JMS protocl. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens you need to run the server first +so open a command prompt, navigate to the helloworld-ws-service-jms sample directory +and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer + + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient + + +Sample Overview +--------------- +The sample provides two components that are have a reference with a +web service binding. The binding refers to WSDL that identifies the service +exposed by the helloworld-ws-service-jms sample. + +helloworld-ws-reference-jms/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldJmsClient.java - starts the SCA Runtime and + deploys the helloworldwsjmsclient + .composite. It then calls the + HelloWorldServiceComponent + resources/ + wsdl + helloworld.wsdl - the service description that the + SCA reference uses to bind to + helloworldwsjmsclient.composite - the SCA assembly for this sample + helloworldwsjms.composite - the SCA assembly for the server + that is used by the JUnit tests + logging.properties - log4j configuration file + test/ + java/ + helloworld/ + HelloWorldJMSClientTestCase.java - JUnit test case + helloworld-ws-reference.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. Before +you do this start up the service that the reference will talk to. To do this +run up the helloworld-ws-service-jms test. Take a look at the README in that sample +and you will see you need the following commands + +cd helloworld-ws-service-jms +ant run + +Once done you can now compile and run this sample using the following commands; + +cd helloworld-ws-reference-jms +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-service-jms sample first as the JUnit test does this for you. + +cd helloworld-ws-reference-jms +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldJmsClientTestCase +08-Jan-2008 10:40:15 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide +r start +INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu +eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active +MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619 +Injected helloWorldService +Called getGreetings +Injected helloWorldService +Called getGreetings +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.89 sec + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/build.xml b/java/sca/contrib/samples/helloworld-ws-reference-jms/build.xml new file mode 100644 index 0000000000..4f83c8ae9d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png b/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png new file mode 100644 index 0000000000..bd2bba41db Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg b/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg new file mode 100644 index 0000000000..333ad53e0a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldwsclient + + HelloWorldServiceComponent + + + HelloWorldService + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/pom.xml b/java/sca/contrib/samples/helloworld-ws-reference-jms/pom.xml new file mode 100644 index 0000000000..d1e77ca628 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/pom.xml @@ -0,0 +1,92 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-reference-jms + Apache Tuscany SCA HelloWorld Web Service Reference JMS Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-helloworld-ws-service-jms + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + org.apache.activemq + apache-activemq + 4.1.1 + test + + + org.apache.activemq + activemq-web-demo + + + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..2186c00e57 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java new file mode 100644 index 0000000000..b3db243a1f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldJmsClient { + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite"); + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8255364e99 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..0dee19550b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + System.out.println("Called getGreetings"); + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + System.out.println("Got Injected helloWorldService"); + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + System.out.println("Injected helloWorldService"); + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite new file mode 100644 index 0000000000..d029ba3e1c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite new file mode 100644 index 0000000000..a4eb217310 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..013a55b61e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java new file mode 100644 index 0000000000..12b0716b5d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + + +/** + * Test case for helloworld web service client + */ +public class HelloWorldJmsClientTestCase { + + private HelloWorldService helloWorldService; + private HelloWorldService helloTuscanyService; + private SCADomain scaClientDomain; + private SCADomain scaServiceDomain; + private BrokerService jmsBroker; + + + @Before + public void startClient() throws Exception { + try { + startBroker(); + scaServiceDomain = SCADomain.newInstance("helloworldwsjms.composite"); + scaClientDomain = SCADomain.newInstance("helloworldwsjmsclient.composite"); + helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + helloTuscanyService = scaClientDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + msg = helloTuscanyService.getGreetings("Green"); + Assert.assertEquals("Hello Green", msg); + + Thread.sleep(2000); + } + + + @After + public void stopClient() throws Exception { + scaServiceDomain.close(); + scaClientDomain.close(); + if (jmsBroker != null) { + jmsBroker.stop(); + } + } + + protected void startBroker() throws Exception { + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/README b/java/sca/contrib/samples/helloworld-ws-reference-lean/README new file mode 100644 index 0000000000..13c89ab2f6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/README @@ -0,0 +1,178 @@ +Hello World Web Service References Sample +========================================= +This sample demonstrates an SCA reference that uses a web service binding. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens you need to run the server first +so open a command prompt, navigate to the helloworld-ws-service sample directory +and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer + + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient + + +Sample Overview +--------------- +The sample provides a single component that is wired to a reference with a +web service binding. The binding refers to WSDL that identifies the service +exposed by the helloworld-ws-service sample. + +helloworld-ws-reference/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldClient.java - starts the SCA Runtime and + deploys the helloworldwsclient + .composite. It then calls the + HelloWorldServiceComponent + resources/ + wsdl + helloworld.wsdl - the service description that the + SCA reference uses to bind to + helloworldwsclient.composite - the SCA assembly for this sample + logging.properties - log4j configuration file + test/ + java/ + helloworld/ + HelloWorldClientTestCase.java - JUnit test case + HelloWorldServerTest.java - starts the Web service + helloworld-ws-reference.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. Before +you do this start up the service that the reference will talk to. To do this +run up the helloworld-ws-service test. Take a look at the README in that sample +and you will see you need the following commands + +cd helloworld-ws-service +ant run + +Once done you can now compile and run this sample using the following commands; + +cd helloworld-ws-reference +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-service sample first as Maven does this for you. + +cd helloworld-ws-reference +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldClientTestCase +14-Jan-2008 14:06:12 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:06:12 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/xml.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client +_1_1.xsd +14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:12 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService +Injected helloWorldService +Called getGreetings +14-Jan-2008 14:06:14 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:06:17 org.apache.catalina.loader.WebappLoader start +INFO: Dual registration of jndi stream handler: factory already defined +14-Jan-2008 14:06:17 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/xml.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client +_1_1.xsd +14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService +Injected helloWorldService +Called getGreetings +14-Jan-2008 14:06:18 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.625 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png b/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png new file mode 100644 index 0000000000..bd2bba41db Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg b/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg new file mode 100644 index 0000000000..354ffbae8f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldwsclient + + HelloWorldServiceComponent + + + HelloWorldService + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/pom.xml b/java/sca/contrib/samples/helloworld-ws-reference-lean/pom.xml new file mode 100644 index 0000000000..ff6907f223 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-reference-lean + Apache Tuscany SCA HelloWorld Web Service Reference Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-helloworld-ws-service + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..7839c2366b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * The HelloWorld client implementation + */ +@Scope("COMPOSITE") @EagerInit +public class HelloWorldClient { + + static HelloWorldService helloWorldService; + + @Reference + public void setHelloWorldService(HelloWorldService service) { + helloWorldService = service; + } + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + scaDomain.close(); + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java new file mode 100644 index 0000000000..137894c469 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * The HelloWorld client implementation + */ +@Scope("COMPOSITE") @EagerInit +public class HelloWorldClient2 { + + private static HelloWorldClient2 client; + + @Reference + public HelloWorldService helloWorldService; + + public HelloWorldClient2() { + client = this; + } + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient2.composite"); + + client.doit(args); + + scaDomain.close(); + } + + void doit(String[] args) { + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java new file mode 100644 index 0000000000..663aa4c852 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * The HelloWorld client implementation + */ +@Scope("COMPOSITE") @EagerInit +public class HelloWorldClient3 { + + @Reference + public HelloWorldService helloWorldService; + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient3.composite"); + + scaDomain.getService(HelloWorldClient3.class, "HelloWorldClient3").doit(args); + + scaDomain.close(); + } + + public void doit(String[] args) { + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java new file mode 100644 index 0000000000..d246225c76 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.oasisopen.sca.ComponentContext; +import org.oasisopen.sca.annotation.Context; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Scope; + +/** + * The HelloWorld client implementation + */ +@Scope("COMPOSITE") @EagerInit +public class HelloWorldClient4 { + + static ComponentContext clientContext; + + @Context + public void setContext(ComponentContext context) { + clientContext = context; + } + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient4.composite"); + + HelloWorldService helloWorldService = clientContext.getService(HelloWorldService.class, "helloWorldService"); + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + scaDomain.close(); + } + + public void doit(String[] args) { + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java new file mode 100644 index 0000000000..5113a98530 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.oasisopen.sca.annotation.EagerInit; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +/** + * The HelloWorld client implementation + */ +@Scope("COMPOSITE") @EagerInit +public class HelloWorldClient5 { + + @Reference + public HelloWorldService helloWorldService; + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient5.composite"); + + scaDomain.close(); + } + + @Init + public void doit() { + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8255364e99 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..991e4b4881 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite new file mode 100644 index 0000000000..6ea14602b3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite new file mode 100644 index 0000000000..3d6364f55f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite new file mode 100644 index 0000000000..106e9db988 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite new file mode 100644 index 0000000000..bbac4c3703 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..662c9affac --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..51b70f47c2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase extends HelloWorldClient { + + private SCADomain scaDomain; + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + + server = new SCATestCaseRunner(HelloWorldTestServer.class); + server.before(); + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java new file mode 100644 index 0000000000..8226ec884e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Starts up the SCA runtime which starts listening for service requests + */ +public class HelloWorldTestServer { + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + try { + scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/README b/java/sca/contrib/samples/helloworld-ws-reference-secure/README new file mode 100644 index 0000000000..167991c8f7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/README @@ -0,0 +1,176 @@ +Hello World Secure Web Service References Sample +================================================ +This sample demonstrates an SCA reference that uses a web service binding. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens you need to run the server first +so open a command prompt, navigate to the helloworld-ws-service sample directory +and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer + + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient + + +Sample Overview +--------------- +The sample provides a single component that is wired to a reference with a +web service binding. The binding refers to WSDL that identifies the service +exposed by the helloworld-ws-service-secure sample. This sample invokes a +secure web-serivce and hence specifies a policy intent named 'authentication' +which is fulfilled by a suitable policyset that is defined for the SCA Domain. +Over the helloworld-ws-reference sample, this sample demonstrate generally +the use of policy intents and policy sets in Tuscany taking the specific instance +of a security policy. + +Note : +------ +The policies mentioned and supported are instances of Tuscany specified policies and +not instnaces of WS-Policy. + +helloworld-ws-reference-secure/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldClient.java - starts the SCA Runtime and + deploys the helloworldwsclient + .composite. It then calls the + HelloWorldServiceComponent + ClientPWCBHandler.java - Callback handler class to provide client password. The + handle(Callback[] callbacks) method of this class is where + code for accessing user registries and retrieving passwords + for given user identifiers can be encapsulated. For example + here is where one could access LDAP registries to obtain or + compare user identities and passwords. + + resources/ + wsdl + helloworld.wsdl - the service description that the + SCA reference uses to bind to + helloworldwsclient.composite - the SCA assembly for this sample + logging.properties - log4j configuration file + definitions.xml - the SCA Definitions file that contains intents and policysets + defined for the SCA Domain + test/ + java/ + helloworld/ + HelloWorldClientTestCase.java - JUnit test case + HelloWorldServerTest.java - starts the Web service + helloworld-ws-reference-secure.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. Before +you do this start up the service that the reference will talk to. To do this +run up the helloworld-ws-service-secure test. Take a look at the README in that sample +and you will see you need the following commands + +cd helloworld-ws-service-secure +ant run + +Once done you can now compile and run this sample using the following commands; + +cd helloworld-ws-reference-secure +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Injected helloWorldService + [java] Called getGreetings + [java] *** Calling Client UserId/Password Handler .... + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-service-secure sample first as Maven does this for you. + +cd helloworld-ws-reference-secure +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldClientTestCase +log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX +Utils). +log4j:WARN Please initialize the log4j system properly. +log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX +Utils). +log4j:WARN Please initialize the log4j system properly. +10-May-2007 13:40:34 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +10-May-2007 13:40:35 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/xml.xsd +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client +_1_1.xsd +10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +Injected helloWorldService +Called getGreetings +*** Calling Client UserId/Password Handler .... +*** Calling Server User/Passwd Handler.... +10-May-2007 13:40:36 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.349 sec + +Results : + + +This shows that the Junit test cases have run successfully. Also note that the client side and server side +callback handlers for authentication have been called. diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/build.xml b/java/sca/contrib/samples/helloworld-ws-reference-secure/build.xml new file mode 100644 index 0000000000..38f1b7549d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png b/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png new file mode 100644 index 0000000000..bd2bba41db Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg b/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg new file mode 100644 index 0000000000..333ad53e0a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldwsclient + + HelloWorldServiceComponent + + + HelloWorldService + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/pom.xml b/java/sca/contrib/samples/helloworld-ws-reference-secure/pom.xml new file mode 100644 index 0000000000..5694276870 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-reference-secure + Apache Tuscany SCA HelloWorld Secure Web Service Reference Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-helloworld-ws-service-secure + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java new file mode 100644 index 0000000000..0f1ebf46d6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ClientPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Client UserId/Password Handler .... "); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + System.out.println("User Id = " + pwcb.getIdentifer()); + pwcb.setPassword("TuscanyWsUserPasswd"); + System.out.println("Set Password = " + pwcb.getPassword()); + } + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..a21619fc8a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldWsPolicyServiceComponent"); + value = helloWorldService.getGreetings("WsPolicyWorld"); + System.out.println(value); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..ca7c90f23e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..27cef47677 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + System.out.println("Called getGreetings"); + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + System.out.println("Got Injected helloWorldService"); + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + System.out.println("Injected helloWorldService"); + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler new file mode 100644 index 0000000000..8b089c7222 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures +# handler classname;qname=;model= +org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://helloworld#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy +org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://helloworld#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml new file mode 100644 index 0000000000..0ab3a5a9f1 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml @@ -0,0 +1,203 @@ + + + + + + + + + + UsernameToken + TuscanyWsUser + helloworld.ClientPWCBHandler" + + PasswordText + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TuscanyWsUser + TuscanyWsUser + helloworld.ClientPWCBHandler + + + + JKS + helloworldKeys.jks + TuscanyWsUserPasswd + + + + + + + + + + + + + + + + + UsernameToken + helloworld.ServerPWCBHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TuscanyWsUser + TuscanyWsUser + helloworld.ServerPWCBHandler + + + + JKS + helloworldKeys.jks + TuscanyWsUserPasswd + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks new file mode 100644 index 0000000000..0b4f2399f0 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks differ diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..904befaf60 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties new file mode 100644 index 0000000000..3a4b43222d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev: 463856 $ $Date: 2006-10-14 03:54:29 +0530 (Sat, 14 Oct 2006) $ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..e6fcc6f4a6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..848c41d1c7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase { + + private HelloWorldService helloWorldService; + private HelloWorldService helloTuscanyService; + private SCADomain scaDomain; + + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + try { + scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); + + server = new SCATestCaseRunner(HelloWorldTestServer.class); + server.before(); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + } + + @Test + public void testEmbeddedReferenceClient() throws Exception { + String msg = helloTuscanyService.getGreetings("Tuscany"); + Assert.assertEquals("Hello Tuscany", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java new file mode 100644 index 0000000000..21f2166560 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Starts up the SCA runtime which starts listening for service requests + */ +public class HelloWorldTestServer { + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + try { + scaDomain = SCADomain.newInstance("helloworldws.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference/README b/java/sca/contrib/samples/helloworld-ws-reference/README new file mode 100644 index 0000000000..13c89ab2f6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/README @@ -0,0 +1,178 @@ +Hello World Web Service References Sample +========================================= +This sample demonstrates an SCA reference that uses a web service binding. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens you need to run the server first +so open a command prompt, navigate to the helloworld-ws-service sample directory +and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer + + +Once the server is running open a command prompt, navigate to this sample +directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient + + +Sample Overview +--------------- +The sample provides a single component that is wired to a reference with a +web service binding. The binding refers to WSDL that identifies the service +exposed by the helloworld-ws-service sample. + +helloworld-ws-reference/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldClient.java - starts the SCA Runtime and + deploys the helloworldwsclient + .composite. It then calls the + HelloWorldServiceComponent + resources/ + wsdl + helloworld.wsdl - the service description that the + SCA reference uses to bind to + helloworldwsclient.composite - the SCA assembly for this sample + logging.properties - log4j configuration file + test/ + java/ + helloworld/ + HelloWorldClientTestCase.java - JUnit test case + HelloWorldServerTest.java - starts the Web service + helloworld-ws-reference.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant. Before +you do this start up the service that the reference will talk to. To do this +run up the helloworld-ws-service test. Take a look at the README in that sample +and you will see you need the following commands + +cd helloworld-ws-service +ant run + +Once done you can now compile and run this sample using the following commands; + +cd helloworld-ws-reference +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-service sample first as Maven does this for you. + +cd helloworld-ws-reference +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldClientTestCase +14-Jan-2008 14:06:12 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:06:12 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/xml.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client +_1_1.xsd +14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:12 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService +Injected helloWorldService +Called getGreetings +14-Jan-2008 14:06:14 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:06:17 org.apache.catalina.loader.WebappLoader start +INFO: Dual registration of jndi stream handler: factory already defined +14-Jan-2008 14:06:17 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/xml.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client +_1_1.xsd +14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:06:17 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService +Injected helloWorldService +Called getGreetings +14-Jan-2008 14:06:18 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.625 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-reference/build.xml b/java/sca/contrib/samples/helloworld-ws-reference/build.xml new file mode 100644 index 0000000000..71ee66b31e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.png b/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.png new file mode 100644 index 0000000000..bd2bba41db Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.svg b/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.svg new file mode 100644 index 0000000000..354ffbae8f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/helloworld-ws-reference.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldwsclient + + HelloWorldServiceComponent + + + HelloWorldService + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference/pom.xml b/java/sca/contrib/samples/helloworld-ws-reference/pom.xml new file mode 100644 index 0000000000..175f7f7038 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-reference + Apache Tuscany SCA HelloWorld Web Service Reference Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-helloworld-ws-service + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..4559b282fe --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate the HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + String value = helloWorldService.getGreetings("World"); + System.out.println(value); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..8255364e99 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..0dee19550b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(String name) { + System.out.println("Called getGreetings"); + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + System.out.println("Got Injected helloWorldService"); + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + System.out.println("Injected helloWorldService"); + this.helloWorldService = helloWorldService; + } +} \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..899ad5ce35 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..662c9affac --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..7ce89179c2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase { + + private HelloWorldService helloWorldService; + private HelloWorldService helloTuscanyService; + private SCADomain scaDomain; + + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + try { + scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); + + server = new SCATestCaseRunner(HelloWorldTestServer.class); + server.before(); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Test + public void testWSClient() throws Exception { + String msg = helloWorldService.getGreetings("Smith"); + Assert.assertEquals("Hello Smith", msg); + } + + @Test + public void testEmbeddedReferenceClient() throws Exception { + String msg = helloTuscanyService.getGreetings("Tuscany"); + Assert.assertEquals("Hello Tuscany", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java new file mode 100644 index 0000000000..8226ec884e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Starts up the SCA runtime which starts listening for service requests + */ +public class HelloWorldTestServer { + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + try { + scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/README b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/README new file mode 100644 index 0000000000..aa4819927a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/README @@ -0,0 +1,92 @@ +Hello World Web Service SDO WebApp Sample +========================================= +This sample demonstrates an SCA web service binding which works with +SDO and runs as a web application. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is is built and copied to your web app container. +See the sections below for instructions on building the war. + +Once the web app is deployed use your browser to visit the following URL; + + http://localhost:8080/sample-helloworld-ws-sdo-webapp + +The port and hostname will of course vary depending on your local installation. + +The resulting web page displayed should show: + + Hello John Smith, Jane Doe! + +Sample Overview +--------------- +The sample builds a war with a single JSP (HelloWorld.jsp). This JSP +calls an SCA component with an SDO parameter. This in turn calls another +SCA component with the SDO parameter. The contents of the SDO are then +returned as a simple string. This sample shows how SDO objects can +be passed into and between services in the context of a web application. + + +helloworld-jsonrpc-webapp/ + src/ + main/ + java/ + helloworld/ + HelloWorld.java - service interface + HelloWorldComponent.java - first service implementation + HelloWorldmpl.java - second service implementation + resources/ + wsdl/ + helloworld.wsdl - the web services description + helloworld.xsd - the SDO description + helloworldws.composite - the SCA assembly for this sample + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorld.jsp - the web application that calls the + SCA service passing in an SDO + + helloworld-ws-sdo-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-ws-sdo-webapp +ant package + +This should result in a war file (sample-helloworld-ws-sdo-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-ws-sdo-webapp + +The port and hostname will of course vary depending on your local installation. + +Building The Sample Using Maven +------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-service sample first as Maven does this for you. + +cd helloworld-ws-sdo-webapp +mvn + +That should end with "BUILD SUCCESSFUL" and create the target/sample-helloworld-ws-sdo-webapp.war +which you can copy to your server. diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/build.xml b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/build.xml new file mode 100644 index 0000000000..386008e707 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/build.xml @@ -0,0 +1,99 @@ + + +]> + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png new file mode 100644 index 0000000000..2590f02a45 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg new file mode 100644 index 0000000000..56a29db23c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg @@ -0,0 +1,221 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + + + HelloWorldImpl + + + SDO + HelloWorld.jsp + + + sample-helloworld-ws-sdo-webapp.war + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/pom.xml b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/pom.xml new file mode 100644 index 0000000000..d714663dc8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/pom.xml @@ -0,0 +1,200 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-sdo-webapp + war + Apache Tuscany SCA HelloWorld Web Service SDO Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sdo + tuscany-sdo-api-r2.1 + 1.1.1 + + + org.apache.tuscany.sdo + tuscany-sdo-lib + 1.1.1 + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1.1 + + + org.apache.tuscany.sca + tuscany-databinding-sdo + 2.0-SNAPSHOT + compile + + + + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + junit + junit + 4.5 + test + + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + runtime + + + + + + ${artifactId} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1.1 + + + generate-helloworld-sdo + generate-sources + + + + ${basedir}/src/main/resources/wsdl/helloworld.xsd + helloworld.type + Type + true + + + ${basedir}/src/main/resources/wsdl/helloworld.wsdl + helloworld + Helloworld + true + + + + + generate + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + true + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..3123223cd3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * HelloWorld.java + * + * This file was auto-generated from WSDL + * by the Apache Axis2 version: #axisVersion# #today# + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/* + * HelloWorld java interface + */ + +@Remotable +public interface HelloWorld { + + /** + * Auto generated method signatures + * + * @param getGreetings + */ + public java.lang.String getGreetings(helloworld.Party getGreetings); + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java new file mode 100644 index 0000000000..fea4e2a16c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + + +public class HelloWorldComponent implements HelloWorld { + + HelloWorld helloWorld; + + public String getGreetings(Party party) { + System.out.println("Called getGreetings"); + return helloWorld.getGreetings(party); + } + + public HelloWorld getHelloWorld() { + System.out.println("Got Injected helloWorld"); + return helloWorld; + } + + public void setHelloWorld(HelloWorld helloWorld) { + System.out.println("Injected helloWorld"); + this.helloWorld = helloWorld; + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..ed99edb2a2 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.util.List; + +import org.oasisopen.sca.annotation.Service; + +@Service(HelloWorld.class) +public class HelloWorldImpl implements HelloWorld { + + public String getGreetings(Party party) { + System.out.println("Greeting party"); + StringBuffer greetings = new StringBuffer(); + greetings.append("Hello "); + List people = party.getPeople(); + int i=0; + for (Person person : people) { + greetings.append(person.getFirstName()); + greetings.append(" "); + greetings.append(person.getLastName()); + i++; + if (i < people.size()) { + greetings.append(", "); + } + } + greetings.append("!"); + + return greetings.toString(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..34396b1b02 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..fe79094b94 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd new file mode 100644 index 0000000000..a0b7c37cd9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp new file mode 100644 index 0000000000..4657c6cdc1 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp @@ -0,0 +1,48 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> +<%@ page import="helloworld.HelloWorld" %> +<%@ page import="helloworld.HelloworldFactory"%> +<%@ page import="helloworld.Party"%> +<%@ page import="helloworld.Person"%> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + HelloWorld helloWorld = (HelloWorld)scaDomain.getService(HelloWorld.class, "HelloWorldServiceComponent"); +%> + +Hello World SDO sample + + +<% + Party party = HelloworldFactory.INSTANCE.createParty(); + Person person = HelloworldFactory.INSTANCE.createPerson(); + person.setFirstName("John"); + person.setLastName("Smith"); + party.getPeople().add(person); + person = HelloworldFactory.INSTANCE.createPerson(); + person.setFirstName("Jane"); + person.setLastName("Doe"); + party.getPeople().add(person); +%> +<%= helloWorld.getGreetings(party) %> + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6f241cc90c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..b7a7df2c17 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,41 @@ + + + + + + + org.apache.tuscany.sca + sample-helloworld-ws-sdo-webapp + 2.0-SNAPSHOT + war + + + + + org.apache.geronimo.configs + sharedlib + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..257e65aad4 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,46 @@ + + + + + + + Apache Tuscany Hello World Web Service SDO Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + tuscany + /services/* + + + + HelloWorld.jsp + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/README b/java/sca/contrib/samples/helloworld-ws-sdo/README new file mode 100644 index 0000000000..be947b1923 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/README @@ -0,0 +1,214 @@ +Hello World Web Service References using SDO Sample +=================================================== +This sample demonstrates an SCA reference that uses a web service binding which works with SDO. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +To run this sample +------------------ +This sample is dependent on helloworld-ws-service. Open a command prompt to start +the service. If you are running ant do the following: + +cd helloworld-ws-service +ant run + +if you don't have ant, issue one of the following commands for windows or *nix: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer + +You should see the following output: + +Buildfile: build.xml + +run-server: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Aug 24, 2007 11:17:33 AM org.apache.catalina.core.StandardEngine sta +rt + [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.ContextConfig d +efaultWebConfig + [java] INFO: No default web.xml + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory + register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0. +xsd + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory + register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_1_1.dtd + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory + register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_1_2.dtd + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory + register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt +aglibrary_2_0.xsd + [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory + register + [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser +vices_1_1.xsd + [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol ini +t + [java] INFO: Initializing Coyote HTTP/1.1 on http-8085 + [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol sta +rt + [java] INFO: Starting Coyote HTTP/1.1 on http-8085 + [java] Aug 24, 2007 11:17:34 AM org.apache.tuscany.sca.http.tomcat.TomcatSe +rver addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService + + [java] HelloWorld server started (press enter to shutdown) + +The server is now ready. + + +Now, open another command window to run the client. + +cd helloworld-ws-sdo +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-sdo.jar helloworld.HelloWorldClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-sdo.jar helloworl.HelloWorldClient + +You should be able to see the following result: + +Buildfile: build.xml + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello David Haney + +BUILD SUCCESSFUL +Total time: 9 seconds + + +Sample Overview +--------------- +The sample provides a single component that is wired to a reference with a +web service binding. The binding refers to WSDL that identifies the service +exposed by the helloworld-ws-service sample. + +helloworld-ws-sdo/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldServiceComponent.java - component implementation + HelloWorldClient.java - starts the SCA Runtime and + deploys the helloworldwsclient + .composite. It then calls the + HelloWorldServiceComponent + resources/ + wsdl + helloworld.wsdl - the service description that the + SCA reference uses to bind to service. + + test/ + java/ + helloworld/ + HelloWorldClientTestCase.java - JUnit test case + helloworld-ws-sdo.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +You can build and run the sample with the binary distribution using Ant. +Make sure that you have started helloworld-ws-service which this sample is dependent on +in a separate command window. You can either follow the instruction at the begining of this +sample file or if you want to build and run the service, follow the README under helloworld-ws-service. + +Now, let's build and run helloworld-ws-sdo sample: + +cd helloworld-ws-sdo +ant +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] Injected helloWorldService + [java] Called getGreetings + [java] Hello World + +Building And Running The Sample Using Maven +------------------------------------------- +You can build and run the sample with either the binary or source distributions using Maven. Please note that you do not need to start helloworld-ws-service in this case since Maven does this for you. + +cd helloworld-ws-sdo +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldClientTestCase +log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX +Utils). +log4j:WARN Please initialize the log4j system properly. +log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX +Utils). +log4j:WARN Please initialize the log4j system properly. +Aug 23, 2007 2:27:32 PM org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.ContextConfig defaultWebConf +ig +INFO: No default web.xml +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +Aug 23, 2007 2:27:32 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServl +etMapping +INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService +Injected helloWorldService +Called getGreetings +Aug 23, 2007 2:27:34 PM org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.502 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/build.xml b/java/sca/contrib/samples/helloworld-ws-sdo/build.xml new file mode 100644 index 0000000000..401315d424 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/build.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.png b/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.png new file mode 100644 index 0000000000..bd2bba41db Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg b/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg new file mode 100644 index 0000000000..333ad53e0a --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldwsclient + + HelloWorldServiceComponent + + + HelloWorldService + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/pom.xml b/java/sca/contrib/samples/helloworld-ws-sdo/pom.xml new file mode 100644 index 0000000000..23c16b4981 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/pom.xml @@ -0,0 +1,139 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-sdo + Apache Tuscany SCA HelloWorld Web Service SDO Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sdo + tuscany-sdo-lib + 1.1.1 + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1.1 + + + org.apache.tuscany.sca + tuscany-databinding-sdo + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1.1 + + + generate-helloworld-sdo + generate-sources + + ${basedir}/src/main/resources/wsdl/helloworld.wsdl + helloworld + Helloworld + true + true + true + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java new file mode 100644 index 0000000000..de4795ceaf --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, locate the + * HelloWorld service and invoke it. + */ +public class HelloWorldClient { + + public final static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + HelloWorldService helloWorldService = + scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + Name name = HelloworldFactory.INSTANCE.createName(); + + name.setFirst("David"); + name.setLast("Haney"); + + String value = helloWorldService.getGreetings(name); + System.out.println(value); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..c42a4d59c3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(Name name) { + return "Hello " + name.getFirst() + " " + name.getLast(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..e03ed4dc25 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..0c3025f0c9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the helloworld service + */ +@Remotable +public interface HelloWorldService { + public String getGreetings(Name name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java new file mode 100644 index 0000000000..711eef63b5 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +/** + * The HelloWorld service implementation + */ +public class HelloWorldServiceComponent implements HelloWorldService { + + HelloWorldService helloWorldService; + + public String getGreetings(Name name) { + System.out.println("Called getGreetings"); + return helloWorldService.getGreetings(name); + } + + public HelloWorldService getHelloWorldService() { + System.out.println("Got Injected helloWorldService"); + return helloWorldService; + } + + public void setHelloWorldService(HelloWorldService helloWorldService) { + System.out.println("Injected helloWorldService"); + this.helloWorldService = helloWorldService; + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..c255df2897 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite new file mode 100644 index 0000000000..d4fba548d5 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/logging.properties b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/logging.properties new file mode 100644 index 0000000000..3dca310cdb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/logging.properties @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# $Rev$ $Date$ +# + +# Custom logging configuration for Tuscany samples +# By default, only INFO level logging is enabled and ALL messages get sent to the console +# For more messages from the runtime, uncomment specific settings at the end of this file +handlers = java.util.logging.ConsoleHandler +java.util.logging.ConsoleHandler.level = ALL +java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter +.level=INFO + +# Uncomment the next setting to get all Tuscany messages (this will be a lot) +#org.apache.tuscany.level=FINEST diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..2ecc0bea43 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java new file mode 100644 index 0000000000..11564c370f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +import junit.framework.Assert; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for helloworld web service client + */ +public class HelloWorldClientTestCase { + + private HelloWorldService helloWorldService; + private SCADomain scaDomain; + + private SCATestCaseRunner server; + + @Before + public void startClient() throws Exception { + try { + scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); + helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); + + server = new SCATestCaseRunner(HelloWorldTestServer.class); + server.before(); + + } catch (Throwable e) { + e.printStackTrace(); + } + } + + @Test + public void testWSClient() throws Exception { + Name name = HelloworldFactory.INSTANCE.createName(); + name.setFirst("John"); + name.setLast("Smith"); + String msg = helloWorldService.getGreetings(name); + Assert.assertEquals("Hello John Smith", msg); + } + + @After + public void stopClient() throws Exception { + server.after(); + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java new file mode 100644 index 0000000000..4b0c40dafd --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Starts up the SCA runtime which starts listening for service requests + */ +public class HelloWorldTestServer { + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + try { + scaDomain = SCADomain.newInstance("helloworldws.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/README b/java/sca/contrib/samples/helloworld-ws-service-jms/README new file mode 100644 index 0000000000..26272b1d91 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/README @@ -0,0 +1,119 @@ +Hello World SOAP/JMS Service Sample +=================================== +This sample demonstrates an SCA service that uses a web service binding using +a SOAP/JMS protocol + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer + +Now the server is started you can use the helloworld-ws-reference-jms sample to +exercise it. + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +web service binding. + +helloworld-ws-service-jms/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldImpl.java - component implementation + HelloWorldServer.java - starts the SCA Runtime and + deploys the helloworldwsjms + .composite and then waits for the + service to be called via web services + resources/ + wsdl/ + helloworld.wsdl - the service description that describes + the exposed service + helloworldwsjms.composite - the SCA assembly for this sample + helloworldwsjmspolicy.composite - shows how the protocol can be + selected using policy. Not run + by the sample + test/ + java/ + helloworld/ + HelloWorldJMSServerTestCase.java- JUnit test case + HelloWorldJMSPolicyServerTestCase.java- JUnit test case + helloworld-ws-service.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd helloworld-ws-service-jms +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. +om.util.StAXUtils). + [java] log4j:WARN Please initialize the log4j system properly. + [java] HelloWorld server started (press enter to shutdown) + +As this point the SCA service is exposed as a web service by a web server +started automatically by the SCA runtime. To stop the server just press +enter. + +To exercise the service run up the helloworld-ws-reference-jms sample. Take a look at +the README in that sample and you will see you need the following commands + +cd helloworld-ws-reference-jms +ant run + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-reference-jms sample as Maven includes a simple ping test to make sure that the +service is available + +cd helloworld-ws-service-jms +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldJmsPolicyServerTestCase +08-Jan-2008 10:41:17 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide +r start +INFO: Axis2 JMS URL=jms:/HelloWorldServiceComponent?java.naming.factory.initial= +org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url= +tcp://localhost:61619&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFac +tory +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.984 sec +Running helloworld.HelloWorldJmsServerTestCase +08-Jan-2008 10:41:22 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide +r start +INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu +eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active +MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.266 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/build.xml b/java/sca/contrib/samples/helloworld-ws-service-jms/build.xml new file mode 100644 index 0000000000..330de7f7e5 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.png b/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.png new file mode 100644 index 0000000000..eab29d0bcd Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.svg b/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.svg new file mode 100644 index 0000000000..8d2ae98c82 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/helloworld-ws-service.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + HelloWorldWebService + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/pom.xml b/java/sca/contrib/samples/helloworld-ws-service-jms/pom.xml new file mode 100644 index 0000000000..90f3e7f297 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/pom.xml @@ -0,0 +1,87 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-service-jms + Apache Tuscany SCA HelloWorld Web Service JMS Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + compile + + + + org.apache.activemq + activemq-core + 4.1.1 + compile + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..2186c00e57 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..5454487ff6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + protected static BrokerService startBroker() throws Exception { + BrokerService jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + return jmsBroker; + } + + public static void main(String[] args) throws Exception { + + BrokerService broker = startBroker(); + SCADomain scaDomain = SCADomain.newInstance("helloworldwsjms.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + broker.stop(); + System.out.println("HelloWorld server stopped"); + // FIXME: Workaround for http://issues.apache.org/jira/browse/AXIS2-3685 + System.exit(0); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..a0081be22d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml new file mode 100644 index 0000000000..8c881ab0bb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml @@ -0,0 +1,66 @@ + + + + + + + The general intent that a transport is available over which SOAP messages flow + + + + + + A JMS transport is required + + + + + + An HTTP transport is required + + + + + + + An HTTPS transport is required + + + + + + + org.apache.activemq.jndi.ActiveMQInitialContextFactory + tcp://localhost:61619 + QueueConnectionFactory + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite new file mode 100644 index 0000000000..67079f738e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite new file mode 100644 index 0000000000..10faf374f3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..3f9e00689e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java b/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java new file mode 100644 index 0000000000..34f8605d5d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldJmsPolicyServerTestCase{ + + private SCADomain scaDomain; + private BrokerService jmsBroker; + + @Before + public void startServer() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("helloworldwsjmspolicy.composite"); + } + + protected void startBroker() throws Exception { + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + if (jmsBroker != null) { + jmsBroker.stop(); + } + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java b/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java new file mode 100644 index 0000000000..03d566cc17 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldJmsServerTestCase{ + + private SCADomain scaDomain; + private BrokerService jmsBroker; + + @Before + public void startServer() throws Exception { + startBroker(); + scaDomain = SCADomain.newInstance("helloworldwsjms.composite"); + } + + protected void startBroker() throws Exception { + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + if (jmsBroker != null) { + jmsBroker.stop(); + } + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/README b/java/sca/contrib/samples/helloworld-ws-service-secure/README new file mode 100644 index 0000000000..f32eb08b05 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/README @@ -0,0 +1,152 @@ +Hello World Secure Web Service Service Sample +============================================= +This sample demonstrates an SCA service that uses a web service binding that is enabled for simple +authentication using UseridToken and PasswordText + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer + +Now the server is started you can use the helloworld-ws-reference-secure sample to +exercise it. + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +web service binding. The service specifies a policy intent named 'authentication' +which is fulfilled by a suitable policyset that is defined for the SCA Domain. Over +the helloworld-ws-service sample, this sample demonstrate generally the use of policy +intents and policy sets in Tuscany taking the specific instance of a security policy. + +Note : +------ +The policies mentioned and supported are instances of Tuscany specified policies and +not instnaces of WS-Policy. + +helloworld-ws-service-secure/ + src/ + main/ + java/ + helloworld/ + HelloWorldService.java - interface description for + HelloWorldServiceComponent + HelloWorldImpl.java - component implementation + HelloWorldServer.java - starts the SCA Runtime and + deploys the helloworldws + .composite and then waits for the + service to be called via web services + ServerPWCBHandler.java - callback handler to authenticate client userid and password. + The handle(Callback[] callbacks) method of this class typically contains + code for accessing user registries and retrieving passwords + for user identifiers sent by the client and verifying them + against the password sent by the client. For example + here is where one could access LDAP registries to obtain or + compare user identities and passwords. + resources/ + wsdl/ + helloworld.wsdl - the service description that describes + the exposed service + helloworldws.composite - the SCA assembly for this sample + definitions.xml - the SCA Definitions file that contains intents and policysets + defined for the SCA Domain + + helloworld-ws-service-secure.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd helloworld-ws-service-secure +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService + [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyS +ervice + [java] HelloWorld server started (press enter to shutdown) + +As this point the SCA service is exposed as a web service by a web server +started automatically by the SCA runtime. The webservice requires clients to +have security headers that carry userid tonken and password text. + +To stop the server just press enter. + +To exercise the service run up the helloworld-ws-reference-secure sample. Take a look at +the README in that sample and you will see you need the following commands + +cd helloworld-ws-reference-secure +ant run + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-reference-secure sample as Maven includes a simple ping test to make sure that the +service is available + +cd helloworld-ws-service-secure +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldServerTestCase +14-Jan-2008 14:23:20 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:23:20 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService +14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyService +14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.734 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/build.xml b/java/sca/contrib/samples/helloworld-ws-service-secure/build.xml new file mode 100644 index 0000000000..29bbae0173 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png b/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png new file mode 100644 index 0000000000..6f7d9dd450 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg b/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg new file mode 100644 index 0000000000..53eb552923 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg @@ -0,0 +1,149 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + HelloWorldWebService + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/pom.xml b/java/sca/contrib/samples/helloworld-ws-service-secure/pom.xml new file mode 100644 index 0000000000..b2a1245d79 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-helloworld-ws-service-secure + Apache Tuscany SCA HelloWorld Secure Web Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..2186c00e57 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..3d43290380 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..a0081be22d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java new file mode 100644 index 0000000000..ded02f09d6 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class ServerPWCBHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + System.out.println("*** Calling Server User/Passwd Handler...."); + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + System.out.println("User Id = " + pwcb.getIdentifer()); + System.out.println("Password = " + pwcb.getPassword()); + + if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) { + if ( pwcb.getIdentifer().equals("TuscanyWsUser") && + pwcb.getPassword().equals("TuscanyWsUserPasswd") ){ + return; + } else { + throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); + } + } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { + pwcb.setPassword("TuscanyWsUserPasswd"); + } + } + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml new file mode 100644 index 0000000000..10fa7b8652 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml @@ -0,0 +1,113 @@ + + + + + + + + + + UsernameToken + helloworld.ServerPWCBHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + TuscanyWsUser + TuscanyWsUser + helloworld.ServerPWCBHandler + + + + JKS + helloworldKeys.jks + TuscanyWsUserPasswd + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks new file mode 100644 index 0000000000..0b4f2399f0 Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks differ diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite new file mode 100644 index 0000000000..d1e18d7929 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..068229be6f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java b/java/sca/contrib/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..4a14afcd9d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase{ + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + scaDomain = SCADomain.newInstance("helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/README b/java/sca/contrib/samples/helloworld-ws-service-webapp/README new file mode 100644 index 0000000000..66040004f8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/README @@ -0,0 +1 @@ +http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/build.xml b/java/sca/contrib/samples/helloworld-ws-service-webapp/build.xml new file mode 100644 index 0000000000..ff850203b3 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/build.xml @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/pom.xml b/java/sca/contrib/samples/helloworld-ws-service-webapp/pom.xml new file mode 100644 index 0000000000..63dd133c2c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/pom.xml @@ -0,0 +1,80 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + + sample-helloworld-ws-service-webapp + Apache Tuscany SCA HelloWorld Web Service Sample Webapp + war + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + + stax + stax-api + 1.0.1 + provided + + + + + javax.servlet + servlet-api + 2.3 + provided + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..a75187f0d7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..18f74b083f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..0b95fbd14f --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite new file mode 100644 index 0000000000..114608e4d8 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..c514922045 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,33 @@ + + + + + + + org.apache.tuscany.sca + sample-helloworld-ws-service-webapp + 2.0-SNAPSHOT + war + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..3f3c92fa78 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,45 @@ + + + + + + + Apache Tuscany HelloWorld Web Service Sample + + + org.apache.tuscany.sca.host.webapp.TuscanyContextListener + + + + TuscanyServlet + org.apache.tuscany.sca.host.webapp.TuscanyServlet + + + + TuscanyServlet + /SCA/* + + + + /SCA/HelloWorldComponent/HelloWorldService?wsdl + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/README b/java/sca/contrib/samples/helloworld-ws-service/README new file mode 100644 index 0000000000..72417d3160 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/README @@ -0,0 +1,140 @@ +Holder Pattern Service Sample +====================================== +This sample demonstrates an SCA service that uses a web service binding. The +web service binding has been generated from a given WSDL file: + src/main/resources/wsdl/orderservice.wsdl +The generated binding has been placed in src/main/java/org/examle/orderservice +and was generated via the JDK tool wsimport and the command: + wsimport -d orderservice -keep orderservice.wsdl + +The interesting feature of this sample is that the generated service interface, +OrderService, contains a method with the signature: + public void reviewOrder( + @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) + javax.xml.ws.Holder orderData); +The orderData parameter is an input/output parameter that is provided by the caller, +updated by the service, and returned to the caller. The business object is updated +in place, a common pattern in web services, and not returned as a response. Tuscany +can handle limited instances of this pattern. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-holder-ws-service.jar org.example.orderservice.OrderServiceTestCase + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-holder-ws-service.jar org.example.orderservice.OrderServiceTestCase + +Sample Overview +--------------- +The sample provides a single component that is wired to a service with a +web service binding. + +holder-ws-service/ + src/ + main/ + java/ + org/ + example/ + orderservice + *.java - Web service binding generated from + HelloWorldServiceComponent + resources/ + wsdl/ + orderservice.wsdl - the service description that describes + the exposed service + orderws.composite - the SCA assembly that uses this service + test/ + java/ + helloworld/ + org/ + example/ + orderservice/ + OrderServiceTestCase.java - JUnit test case + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd holder-ws-service +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:18:47 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService + [java] HelloWorld server started (press enter to shutdown) + +As this point the SCA service is exposed as a web service by a web server +started automatically by the SCA runtime. To stop the server just press +enter. + +To exercise the service run up the helloworld-ws-reference sample. Take a look at +the README in that sample and you will see you need the following commands + +cd holder-ws-reference +ant run + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. When using Maven you don't need to run the helloworld- +ws-reference sample as Maven includes a simple ping test to make sure that the +service is available + +cd holder-ws-service +mvn + +You should see the following output from the test phase. +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running org.example.orderservice.OrderServiceTestCase +Jan 21, 2009 9:31:11 AM org.apache.tuscany.sca.node.impl.NodeImpl +INFO: Creating node: META-INF/sca-deployables/orderws.composite +Jan 21, 2009 9:31:13 AM org.apache.tuscany.sca.node.impl.NodeImpl configureNode +INFO: Loading contribution: file:/E:/t/branches/sca-java-1.x/samples/holder-ws-webservice/target/classes/ +Jan 21, 2009 9:31:14 AM org.apache.tuscany.sca.node.impl.NodeImpl configureNode +INFO: Loading composite: file:/E:/t/branches/sca-java-1.x/samples/holder-ws-webservice/target/classes/META-INF/sca-deployables/orderws.composite +Jan 21, 2009 9:31:14 AM org.apache.tuscany.sca.node.impl.NodeImpl start +INFO: Starting node: META-INF/sca-deployables/orderws.composite +- No JMS connection factories are defined.Will not listen for any JMS messages +Jan 21, 2009 9:31:15 AM org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.14 +Jan 21, 2009 9:31:15 AM org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +Jan 21, 2009 9:31:15 AM org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +Jan 21, 2009 9:31:15 AM org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +- No JMS connection factories are defined.Will not listen for any JMS messages +Jan 21, 2009 9:31:15 AM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping +INFO: Added Servlet mapping: http://T602010:8085/OrderService +>>> Order submitted=Order[customerId=cust1234,orderId=0,total=50.0,status=Created] +>>> OrderService.reviewOrder return=Order[customerId=cust1234,orderId=0,total=50.0,status=Approved] +>>> Order returned=Order[customerId=cust1234,orderId=0,total=50.0,status=Approved] +Jan 21, 2009 9:31:16 AM org.apache.tuscany.sca.node.impl.NodeImpl stop +INFO: Stopping node: META-INF/sca-deployables/orderws.composite +Jan 21, 2009 9:31:17 AM org.apache.tuscany.sca.http.tomcat.TomcatServer removeServletMapping +INFO: Removed Servlet mapping: http://T602010:8085/OrderService +Jan 21, 2009 9:31:17 AM org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 + +Note the console output with ">>>" prefix. This shows that an order was submitted in +the "Created" state, handled by the OrderService reviewOrder method, and returned in +the "Approved" state. This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/helloworld-ws-service/build.xml b/java/sca/contrib/samples/helloworld-ws-service/build.xml new file mode 100644 index 0000000000..7a59628c7b --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.png b/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.png new file mode 100644 index 0000000000..eab29d0bcd Binary files /dev/null and b/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.png differ diff --git a/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.svg b/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.svg new file mode 100644 index 0000000000..61cd93ead9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/helloworld-ws-service.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldws + + HelloWorldServiceComponent + + HelloWorldWebService + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/pom.xml b/java/sca/contrib/samples/helloworld-ws-service/pom.xml new file mode 100644 index 0000000000..a895191917 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5-SNAPSHOT + ../../pom.xml + + sample-holder-ws-service + Apache Tuscany SCA Holder Input/Output Web Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.5-SNAPSHOT + compile + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 1.5-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..a75187f0d7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the HelloWorld service. + */ +@Service(HelloWorldService.class) +public class HelloWorldImpl implements HelloWorldService { + + public String getGreetings(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java new file mode 100644 index 0000000000..c37bfcda65 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the helloworld Web service endpoint. + */ +public class HelloWorldServer { + + public static void main(String[] args) { + + SCADomain scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + + try { + System.out.println("HelloWorld server started (press enter to shutdown)"); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("HelloWorld server stopped"); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java new file mode 100644 index 0000000000..513c2e3129 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the HelloWorld greetings service. + */ +@Remotable +public interface HelloWorldService { + + public String getGreetings(String name); +} + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java new file mode 100644 index 0000000000..e472b2bada --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java @@ -0,0 +1,56 @@ + +package org.example.orderservice; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the org.example.orderservice package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.example.orderservice + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link ReviewOrderResponse } + * + */ + public ReviewOrderResponse createReviewOrderResponse() { + return new ReviewOrderResponse(); + } + + /** + * Create an instance of {@link Order } + * + */ + public Order createOrder() { + return new Order(); + } + + /** + * Create an instance of {@link ReviewOrder } + * + */ + public ReviewOrder createReviewOrder() { + return new ReviewOrder(); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java new file mode 100644 index 0000000000..7508887a7d --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java @@ -0,0 +1,129 @@ + +package org.example.orderservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for order complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="order">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="customerId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="status" type="{http://www.example.org/OrderService/}status" minOccurs="0"/>
+ *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}double"/>
+ *         <element name="orderId" type="{http://www.w3.org/2001/XMLSchema}int"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "order", propOrder = { + "customerId", + "status", + "total", + "orderId" +}) +public class Order { + + protected String customerId; + protected Status status; + protected double total; + protected int orderId; + + /** + * Gets the value of the customerId property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCustomerId() { + return customerId; + } + + /** + * Sets the value of the customerId property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCustomerId(String value) { + this.customerId = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link Status } + * + */ + public Status getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link Status } + * + */ + public void setStatus(Status value) { + this.status = value; + } + + /** + * Gets the value of the total property. + * + */ + public double getTotal() { + return total; + } + + /** + * Sets the value of the total property. + * + */ + public void setTotal(double value) { + this.total = value; + } + + /** + * Gets the value of the orderId property. + * + */ + public int getOrderId() { + return orderId; + } + + /** + * Sets the value of the orderId property. + * + */ + public void setOrderId(int value) { + this.orderId = value; + } + + // Added manually from wsimport generated class to improve debugging. + public String toString() { + return "Order[customerId=" + customerId + ",orderId=" + orderId + ",total=" + total + ",status=" + status.value() + "]"; + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java new file mode 100644 index 0000000000..a11d733cc9 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java @@ -0,0 +1,37 @@ + +package org.example.orderservice; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.Holder; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 in JDK 6 + * Generated source version: 2.1 + * + */ +@WebService(name = "OrderService", targetNamespace = "http://www.example.org/OrderService/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface OrderService { + + + /** + * + * @param myData + */ + @WebMethod(action = "http://www.example.org/OrderService/reviewOrder") + @RequestWrapper(localName = "reviewOrder", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrder") + @ResponseWrapper(localName = "reviewOrderResponse", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrderResponse") + public void reviewOrder( + @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) + Holder myData); + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java new file mode 100644 index 0000000000..0e084bf459 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.example.orderservice; + +// import org.oasisopen.sca.annotation.Service; +import java.util.Random; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.xml.ws.Holder; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +/** + * This class implements the OrderService service. + */ +// @Service(OrderService.class) +public class OrderServiceImpl implements OrderService { + + /** This dummy implementation approves or rejects orders: + * < 100 - always approved. + * 100-1100 - randomly approved. Probability = (1100 - amount)/10 + * >1100 - always rejected. + */ + // public Order reviewOrder(Order order) { + @WebMethod(action = "http://www.example.org/OrderService/reviewOrder") + @RequestWrapper(localName = "reviewOrder", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrder") + @ResponseWrapper(localName = "reviewOrderResponse", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrderResponse") + public void reviewOrder( + @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) + Holder myData) { + Order order = myData.value; + double total = order.getTotal(); + if ( total < 100.0 ) { + order.setStatus( Status.APPROVED ); + } else if ( total > 1100.0 ) { + order.setStatus( Status.REJECTED ); + } else { + int probability = (int) ((-100.0 + total) / 10.0); + Random approver = new Random(); + if ( approver.nextInt( 100 ) < probability ) + order.setStatus( Status.APPROVED ); + else + order.setStatus( Status.REJECTED ); + } + System.out.println( ">>> OrderService.reviewOrder return=" + order ); + // return order; + } +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java new file mode 100644 index 0000000000..9c8ff711ea --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java @@ -0,0 +1,66 @@ + +package org.example.orderservice; + +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 in JDK 6 + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "OrderService", targetNamespace = "http://www.example.org/OrderService/", wsdlLocation = "META-INF/sca-deployables/orderservice.wsdl") +public class OrderService_Service + extends Service +{ + + private final static URL ORDERSERVICE_WSDL_LOCATION; + + static { + URL url = null; + try { + url = new URL("META-INF/sca-deployables/orderservice.wsdl"); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + ORDERSERVICE_WSDL_LOCATION = url; + } + + public OrderService_Service(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public OrderService_Service() { + super(ORDERSERVICE_WSDL_LOCATION, new QName("http://www.example.org/OrderService/", "OrderService")); + } + + /** + * + * @return + * returns OrderService + */ + @WebEndpoint(name = "OrderServiceSOAP") + public OrderService getOrderServiceSOAP() { + return (OrderService)super.getPort(new QName("http://www.example.org/OrderService/", "OrderServiceSOAP"), OrderService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns OrderService + */ + @WebEndpoint(name = "OrderServiceSOAP") + public OrderService getOrderServiceSOAP(WebServiceFeature... features) { + return (OrderService)super.getPort(new QName("http://www.example.org/OrderService/", "OrderServiceSOAP"), OrderService.class, features); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java new file mode 100644 index 0000000000..9e7192a0d0 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java @@ -0,0 +1,64 @@ + +package org.example.orderservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="myData" type="{http://www.example.org/OrderService/}order"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "myData" +}) +@XmlRootElement(name = "reviewOrder") +public class ReviewOrder { + + @XmlElement(required = true) + protected Order myData; + + /** + * Gets the value of the myData property. + * + * @return + * possible object is + * {@link Order } + * + */ + public Order getMyData() { + return myData; + } + + /** + * Sets the value of the myData property. + * + * @param value + * allowed object is + * {@link Order } + * + */ + public void setMyData(Order value) { + this.myData = value; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java new file mode 100644 index 0000000000..90dbc3f25e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java @@ -0,0 +1,64 @@ + +package org.example.orderservice; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="myData" type="{http://www.example.org/OrderService/}order"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "myData" +}) +@XmlRootElement(name = "reviewOrderResponse") +public class ReviewOrderResponse { + + @XmlElement(required = true) + protected Order myData; + + /** + * Gets the value of the myData property. + * + * @return + * possible object is + * {@link Order } + * + */ + public Order getMyData() { + return myData; + } + + /** + * Sets the value of the myData property. + * + * @param value + * allowed object is + * {@link Order } + * + */ + public void setMyData(Order value) { + this.myData = value; + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java new file mode 100644 index 0000000000..73a1b5c45e --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java @@ -0,0 +1,57 @@ + +package org.example.orderservice; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for status. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="status">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="Created"/>
+ *     <enumeration value="Submitted"/>
+ *     <enumeration value="Approved"/>
+ *     <enumeration value="Rejected"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "status") +@XmlEnum +public enum Status { + + @XmlEnumValue("Created") + CREATED("Created"), + @XmlEnumValue("Submitted") + SUBMITTED("Submitted"), + @XmlEnumValue("Approved") + APPROVED("Approved"), + @XmlEnumValue("Rejected") + REJECTED("Rejected"); + private final String value; + + Status(String v) { + value = v; + } + + public String value() { + return value; + } + + public static Status fromValue(String v) { + for (Status c: Status.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java new file mode 100644 index 0000000000..64c056b7fb --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java @@ -0,0 +1,2 @@ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.org/OrderService/") +package org.example.orderservice; diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite new file mode 100644 index 0000000000..d767625ae7 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite new file mode 100644 index 0000000000..d34891d1af --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl new file mode 100644 index 0000000000..454763410c --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl new file mode 100644 index 0000000000..fd8ef74403 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java b/java/sca/contrib/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java new file mode 100644 index 0000000000..189332be91 --- /dev/null +++ b/java/sca/contrib/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import static junit.framework.Assert.assertEquals; +import static junit.framework.Assert.assertNotNull; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the helloworld server is available + */ +public class HelloWorldServerTestCase{ + + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @Test + public void testServiceCall() throws IOException { + HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); + assertNotNull(helloWorldService); + + assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/README b/java/sca/contrib/samples/host-webapp-calculator/README new file mode 100644 index 0000000000..690152ff65 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/README @@ -0,0 +1,108 @@ +Calculator Sample Exposing Web Services In A WebApp +=================================================== +This sample uses the same code as the calculator sample, it deploys the +sample wrapped in a web app and exposes the AddService as a web service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-webapp + +The sample is configured to use a service on port 8080. If your servlet container +is using a port other than 8080 then you will need to edit the Calculator.composite +and change the uri attribute of the used by the CalculatorServiceComponent +to use the correct port. + +Sample Overview +--------------- +The sample provides a single calculator service with a default SCA (java) +binding. The CalculatorClient exercises this interface by calling add, +subtract, multiply and divide operations. This results in messages passing to +the appropriate components in the composite. + +calculator-webapp/ + src/ + main/ + java/ + calculator/ + AddService.java - As calculator sample + AddServiceImpl.java + CalculatorClient.java - As calculator sample + CalculatorService.java - As calculator sample + CalculatorServiceImpl.java + DivideService.java - As calculator sample + DivideServiceImpl.java + MultiplyService.java - As calculator sample + MultiplyServiceImpl.java + SubtractService.java - As calculator sample + SubtractServiceImpl.java + resources/ + Calculator.composite - As calculator sample except that the + connection between the CalculatorService + and the AddService is web services + webapp + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime and maps service + calls to the TuscanyServlet + calc.jsp - the web application that makes use of the + SCA application + + calculator.png - a pictorial representation of the sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + README - this file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd calculator-ws-webapp +ant package + +This should result in a war file (sample-calculator-ws-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in you +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-calculator-ws-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see the following output. + +Expression Result +2 + 3 5.0 +3 - 2 1.0 +3 * 2 6.0 +3 / 2 1.5 + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd calculator-ws-webapp +mvn + +Again this should result in a war file (sample-calculator-ws-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/build.xml b/java/sca/contrib/samples/host-webapp-calculator/build.xml new file mode 100644 index 0000000000..bef3f946e9 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/build.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/calculator-web.png b/java/sca/contrib/samples/host-webapp-calculator/calculator-web.png new file mode 100644 index 0000000000..f482b8d1c8 Binary files /dev/null and b/java/sca/contrib/samples/host-webapp-calculator/calculator-web.png differ diff --git a/java/sca/contrib/samples/host-webapp-calculator/calculator-web.svg b/java/sca/contrib/samples/host-webapp-calculator/calculator-web.svg new file mode 100644 index 0000000000..1b7015b156 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/calculator-web.svg @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + Calculator + + CalculatorServiceComponent + + + CalculatorService + AddServiceComponent + + SubtractServiceComponent + + MultiplyServiceComponent + + DivideServiceComponent + addService + subtractService + multiplyService + divideService + + + + + + calc.jsp + + AppServer SOAP local local local + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/pom.xml b/java/sca/contrib/samples/host-webapp-calculator/pom.xml new file mode 100644 index 0000000000..2e1c719e7d --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/pom.xml @@ -0,0 +1,162 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-host-webapp-calculator + war + Apache Tuscany SCA Host Webapp Calculator Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-distribution-api + pom + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-distribution-core + pom + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-distribution-webservice + pom + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-distribution-webapp + pom + 2.0-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + + ant + ant-trax + 1.6.5 + + + + + + test-ant-scripts + package + + run + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddService.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddService.java new file mode 100644 index 0000000000..19e43317eb --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The interface for the add service + */ +@Remotable +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java new file mode 100644 index 0000000000..e96b0faa96 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Service; + +/** + * An implementation of the Add service + */ +@Service(AddService.class) +public class AddServiceImpl implements AddService { + + public double add(double n1, double n2) { + System.err.println("Adding " + n1 + " to " + n2); + return n1 + n2; + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java new file mode 100644 index 0000000000..031fa8b912 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..39f55ca31f --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +import org.oasisopen.sca.annotation.Reference; + +/** + * An implementation of the Calculator service. + */ +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java new file mode 100644 index 0000000000..497dafd4fd --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the divide service + */ +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java new file mode 100644 index 0000000000..f7ac0b7287 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Divide service. + */ +public class DivideServiceImpl implements DivideService { + + public double divide(double n1, double n2) { + return n1 / n2; + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java new file mode 100644 index 0000000000..5290605938 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the multiply service + */ +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java new file mode 100644 index 0000000000..b7dca792b2 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the Multiply service. + */ +public class MultiplyServiceImpl implements MultiplyService { + + public double multiply(double n1, double n2) { + return n1 * n2; + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java new file mode 100644 index 0000000000..376b3e5bb9 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * The interface for the subtract service + */ +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java new file mode 100644 index 0000000000..77b128ab8d --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package calculator; + +/** + * An implementation of the subtract service. + */ +public class SubtractServiceImpl implements SubtractService { + + public double subtract(double n1, double n2) { + return n1 - n2; + } + +} diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/resources/Calculator.composite b/java/sca/contrib/samples/host-webapp-calculator/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..6a00b85f62 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/resources/Calculator.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8e3132eaa1 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..59bbb0de83 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,34 @@ + + + + + + + org.apache.tuscany.sca + sample-calculator-ws-webapp + 2.0-SNAPSHOT + war + + + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite new file mode 100644 index 0000000000..e839694501 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite @@ -0,0 +1,24 @@ + + + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..701ba48203 --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Calculator Web Service Sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + calc.jsp + + + diff --git a/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/calc.jsp b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/calc.jsp new file mode 100644 index 0000000000..4c4366747d --- /dev/null +++ b/java/sca/contrib/samples/host-webapp-calculator/src/main/webapp/calc.jsp @@ -0,0 +1,50 @@ +<%-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--%> + +<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> +<%@ page import="calculator.CalculatorService" %> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<% + SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); + CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); +%> + +Calculator sample + + + + + + + + + + + + + + + + + + +
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
+ + diff --git a/java/sca/contrib/samples/implementation-composite/README b/java/sca/contrib/samples/implementation-composite/README new file mode 100644 index 0000000000..27de00e8ef --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/README @@ -0,0 +1,116 @@ +Composite Implementation Sample +=============================== + +This sample shows how composites can be used to implement components. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-composite.jar composite.CompositeClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-composite.jar composite.CompositeClient + + +Sample Overview +--------------- + +The sample is comprised of three composites. Take a look at the composite file +or the .svg/.png file which shows the composite file in pictorial form. The +OuterComposite defines three components two of which are implemented using +composites. The SourceComponent calls each TargetComponent in turn. There is a +callback which returns from each TargetComponent to the SourceComponent. + +implementation-composite/ + src/ + main/ + java/ + composite/ + Source.java - interface for the source component + SourceImpl.java - implementation for the source component + SourceCallback.java - source component callback interface + Target.java - interface for the target component + TargetImpl.java - implementation for the target component + CompositeClient.java - starts the SCA Runtime and + deploys the OuterComposite.composite. + This in turn pulls in the two inner + composites + resources/ + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + OuterComposite.composite - the top level SCA assembly for this sample + InnerComposite.composite - included by OuterComposite.composite + InnerComposite2.composite - included by OuterComposite.composite + test/ + java/ + composite/ + CompositeTestCase.java - JUnit test case + implementation-composite.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd implementation-composite +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Main thread Thread[main,5,main] + [java] Source: Client.main -> Source.clientMethod + [java] Source: Client.main => Source.clientMethod2 + [java] Sleeping ... + [java] Target: Client.main -> Source.clientMethod + [java] Work thread Thread[pool-1-thread-1,5,main] + [java] Result: Client.main -> Source.clientMethod -> Target.someMethod + [java] Target: Client.main => Source.clientMethod2 + [java] Work thread Thread[pool-1-thread-2,5,main] + [java] Result: Client.main => Source.clientMethod2 -> Target.someMethod + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd implementation-composite +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running composite.CompositeTestCase +Main thread Thread[main,5,main] +Source: Client.main -> Source.clientMethod +Source: Client.main => Source.clientMethod2 +Sleeping ... +Target: Client.main => Source.clientMethod2 +Work thread Thread[pool-1-thread-2,5,main] +Result: Client.main => Source.clientMethod2 -> Target.someMethod +Target: Client.main -> Source.clientMethod +Work thread Thread[pool-1-thread-1,5,main] +Result: Client.main -> Source.clientMethod -> Target.someMethod +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.973 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/implementation-composite/build.xml b/java/sca/contrib/samples/implementation-composite/build.xml new file mode 100644 index 0000000000..7aa31aab8b --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-composite/implementation-composite.png b/java/sca/contrib/samples/implementation-composite/implementation-composite.png new file mode 100644 index 0000000000..4c6d71bc03 Binary files /dev/null and b/java/sca/contrib/samples/implementation-composite/implementation-composite.png differ diff --git a/java/sca/contrib/samples/implementation-composite/implementation-composite.svg b/java/sca/contrib/samples/implementation-composite/implementation-composite.svg new file mode 100644 index 0000000000..0e60354aab --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/implementation-composite.svg @@ -0,0 +1,658 @@ + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + OuterComposite + InnerComposite + + OuterComposite.composite + InnerComposite.composite + InnerComposite2.composite + SourceComponent + + TargetComponentRef TargetComponentRef2 + + TargetComponent + + TargetComponent2 + + + InnerSourceService + InnerSourceComponent + + + + + + TargetComponentRef TargetComponentRef2 + + promote promote + InnerTargetService + InnerTargetComponent + + TargetImpl Target + + Target + + SourceImpl + Source + SourceCallback + + + + + Target Source + InnerComposite2 promote promote + diff --git a/java/sca/contrib/samples/implementation-composite/pom.xml b/java/sca/contrib/samples/implementation-composite/pom.xml new file mode 100644 index 0000000000..91f8af09f3 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/pom.xml @@ -0,0 +1,72 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-implementation-composite + Apache Tuscany SCA Composite Sample + A sample showing local wiring of a component implemented by a nested composite + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/CompositeClient.java new file mode 100644 index 0000000000..bf743e1797 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/CompositeClient.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package composite; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Simple client program that invokes the components that we wired together. + */ +public class CompositeClient { + + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance(); + + Source source = scaDomain.getService(Source.class, "SourceComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Source.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Source.java new file mode 100644 index 0000000000..d0efcc1df1 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Source.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +public interface Source { + + void clientMethod(String arg); +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceCallback.java new file mode 100644 index 0000000000..baa95a8e39 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceCallback.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +public interface SourceCallback { + + void receiveResult(String result); +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceImpl.java new file mode 100644 index 0000000000..8e2b347604 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/SourceImpl.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + + +@Service(Source.class) +@Scope("COMPOSITE") +public class SourceImpl implements Source, SourceCallback { + + private Target targetReference; + private Target targetReference2; + + @Reference + public void setTargetReference(Target target) { + this.targetReference = target; + } + + @Reference + public void setTargetReference2(Target target) { + this.targetReference2 = target; + } + + public void clientMethod(String arg) { + System.out.println("Source: " + arg + " -> Source.clientMethod"); + targetReference.someMethod(arg + " -> Source.clientMethod"); + + System.out.println("Source: " + arg + " => Source.clientMethod2"); + targetReference2.someMethod(arg + " => Source.clientMethod2"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + } +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Target.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Target.java new file mode 100644 index 0000000000..703e72fc10 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/Target.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; + + +@Callback(SourceCallback.class) +public interface Target { + + @OneWay + void someMethod(String arg); +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/TargetImpl.java new file mode 100644 index 0000000000..cd9a9746fa --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/java/composite/TargetImpl.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + + +@Service(Target.class) +@Scope("COMPOSITE") +public class TargetImpl implements Target { + + private SourceCallback sourceCallback; + + @Callback + public void setSourceCallback(SourceCallback sourceCallback) { + this.sourceCallback = sourceCallback; + } + + public void someMethod(String arg) { + System.out.println("Target: " + arg); + sourceCallback.receiveResult(arg + " -> Target.someMethod"); + } +} diff --git a/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite.composite b/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite.composite new file mode 100644 index 0000000000..3376ac8ff5 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite2.composite new file mode 100644 index 0000000000..c9eff4fa9d --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/resources/InnerComposite2.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/java/sca/contrib/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..e675fd3624 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/implementation-composite/src/main/resources/OuterComposite.composite b/java/sca/contrib/samples/implementation-composite/src/main/resources/OuterComposite.composite new file mode 100644 index 0000000000..cb1c1e13d4 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/main/resources/OuterComposite.composite @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/java/sca/contrib/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java new file mode 100644 index 0000000000..9e9a4b44a4 --- /dev/null +++ b/java/sca/contrib/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package composite; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class CompositeTestCase extends TestCase { + + private SCADomain scaDomain; + private Source source; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance(); + source = scaDomain.getService(Source.class, "SourceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + try { + System.out.println("Main thread " + Thread.currentThread()); + source.clientMethod("Client.main"); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/README b/java/sca/contrib/samples/implementation-crud-extension/README new file mode 100644 index 0000000000..5e8190648f --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/README @@ -0,0 +1,83 @@ +Implementation CRUD Sample +========================== +This sample demonstrates how new implementation types are constructed for +Apache Tuscany SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you want to try out the CRUD implementation type that this sample provides +please see the implementation-crud sample that provides the necessary client +code to bring up an application that uses this implementation extension. + +Sample Overview +--------------- +This sample contains a CRUD implementation type as an example of how to create +new implementation types. Components using this implementation type always +expose the same Create, Retrieve, Update and Delete interface. This sample +uses a singleton ResourceManager to perform the CRUD operations but of course +a real component would provide a real implementation. + +implementation-crud-extension/ + src/ + main/ + java/ + crud/ - implementation model interfaces + backend/ - fake component implementation + impl/ - implementations of the model interfaces + provider/ - runtime implementation + resources/ + META-INF/ + services/ - declares the extension + test/ + java/ + crud/ + CRUDTestCase.java - JUnit test case + resources/ + crud.composite - the SCA assembly used during unit testing + + build.xml - the Ant build file + pom.xml - the Maven build file + +Building The Sample Extension Using Ant +----------------------------------------- +With the binary distribution the sample extension can be built using Ant as +follows + +cd implementation-crud-extension +ant compile + +See the implementation-crud sample to run a sample that uses this +implementation extension. + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built +using Maven as follows. + +cd implementation-crud-extension +mvn + +Maven will also test that the sample extension built properly. You should see +the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running crud.CRUDTestCase +Starting CRUDServiceComponent +create(ABC) in tmp +retrieve(0) +update(0) +retrieve(0) +delete(0) +retrieve(0) +Stopping CRUDServiceComponent +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/implementation-crud-extension/build.xml b/java/sca/contrib/samples/implementation-crud-extension/build.xml new file mode 100644 index 0000000000..88d308e6fc --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-crud-extension/pom.xml b/java/sca/contrib/samples/implementation-crud-extension/pom.xml new file mode 100644 index 0000000000..6e044bd68e --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-implementation-crud-extension + Apache Tuscany SCA CRUD Implementation Extension Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-assembly + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface-java-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUD.java new file mode 100644 index 0000000000..b23d85887b --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUD.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package crud; + +/** + * The service interface of the single CRUD service provided by CRUD components. + */ +public interface CRUD { + + /** + * Create a new resource. + * @param resource + * @return + */ + String create(Object resource); + + /** + * Retrieve a resource. + * @param id + * @return + */ + Object retrieve(String id); + + /** + * Update a resource. + * @param id + * @param resource + * @return + */ + Object update(String id, Object resource); + + /** + * Delete a resource. + * @param id + */ + void delete(String id); + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java new file mode 100644 index 0000000000..49be844f93 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package crud; + +import org.apache.tuscany.sca.assembly.Implementation; + +/** + * The model representing a sample CRUD implementation in an SCA assembly model. + * + * The sample CRUD implementation is not a full blown implementation, it only + * supports a subset of what a component implementation can support: + * - a single fixed service (as opposed to a list of services typed by different interfaces + * - a directory attribute used to specify where a CRUD component is going to persist + * resources + * - no references or properties + * - no policy intents or policy sets + */ +public interface CRUDImplementation extends Implementation { + + /** + * Returns the directory used by CRUD implementations to persist resources. + * + * @return the directory used to persist resources + */ + public String getDirectory(); + + /** + * Sets the directory used by CRUD implementations to persist resources. + * + * @param directory the directory used to persist resources + */ + public void setDirectory(String directory); + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java new file mode 100644 index 0000000000..fa83c63c1b --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud; + +import crud.CRUDImplementation; + + +/** + * A factory for the sample CRUD implementation model. + */ +public interface CRUDImplementationFactory { + + /** + * Creates a new CRUD implementation. + * + * @return + */ + CRUDImplementation createCRUDImplementation(); + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java new file mode 100644 index 0000000000..cc0795a735 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud.backend; + +import java.util.HashMap; +import java.util.Map; + +/** + * A fake resource manager implementation used as a backend by the sample + * CRUD component implementation. + */ +public class ResourceManager { + private static int counter; + private static final Map store = new HashMap(); + private String directory; + + /** + * Constructs a new resource manager. + * + * @param directory the directory where to persist resources + */ + public ResourceManager(String directory) { + super(); + this.directory = directory; + } + + /** + * Creates a new resource. + * + * @param resource + * @return + */ + public String createResource(Object resource) { + System.out.println("create(" + resource + ") in " + directory); + String key = String.valueOf(counter++); + store.put(key, resource); + return key; + } + + /** + * Deletes a resource. + * + * @param id + */ + public void deleteResource(String id) { + System.out.println("delete(" + id + ")"); + store.remove(id); + } + + /** + * Retrieves a resource. + * + * @param id + * @return + */ + public Object retrieveResource(String id) { + System.out.println("retrieve(" + id + ")"); + return store.get(id); + } + + /** + * Updates a resource. + * + * @param id + * @param resource + * @return + */ + public Object updateResource(String id, Object resource) { + System.out.println("update(" + id + ")"); + return store.put(id, resource); + } + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java new file mode 100644 index 0000000000..2f1e5fcba8 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud.impl; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; + +import crud.CRUDImplementation; +import crud.CRUDImplementationFactory; + + +/** + * A factory for the CRUD implementation model. + */ +public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory { + + private AssemblyFactory assemblyFactory; + private JavaInterfaceFactory javaFactory; + + public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) { + this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); + } + + public CRUDImplementation createCRUDImplementation() { + return new CRUDImplementationImpl(assemblyFactory, javaFactory); + } + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java new file mode 100644 index 0000000000..383a035e69 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package crud.impl; + +import java.util.Collections; +import java.util.List; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.ConstrainingType; +import org.apache.tuscany.sca.assembly.Property; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; + +import crud.CRUD; +import crud.CRUDImplementation; + + +/** + * The model representing a sample CRUD implementation in an SCA assembly model. + */ +class CRUDImplementationImpl implements CRUDImplementation { + + private Service crudService; + private String directory; + + /** + * Constructs a new CRUD implementation. + */ + CRUDImplementationImpl(AssemblyFactory assemblyFactory, + JavaInterfaceFactory javaFactory) { + + // CRUD implementation always provide a single service exposing + // the CRUD interface, and have no references and properties + crudService = assemblyFactory.createService(); + crudService.setName("CRUD"); + JavaInterface javaInterface; + try { + javaInterface = javaFactory.createJavaInterface(CRUD.class); + } catch (InvalidInterfaceException e) { + throw new IllegalArgumentException(e); + } + JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); + interfaceContract.setInterface(javaInterface); + crudService.setInterfaceContract(interfaceContract); + } + + public String getDirectory() { + return directory; + } + + public void setDirectory(String directory) { + this.directory = directory; + } + + public ConstrainingType getConstrainingType() { + // The sample CRUD implementation does not support constrainingTypes + return null; + } + + public List getProperties() { + // The sample CRUD implementation does not support properties + return Collections.emptyList(); + } + + public List getServices() { + // The sample CRUD implementation provides a single fixed CRUD service + return Collections.singletonList(crudService); + } + + public List getReferences() { + // The sample CRUD implementation does not support properties + return Collections.emptyList(); + } + + public String getURI() { + // The sample CRUD implementation does not have a URI + return null; + } + + public void setConstrainingType(ConstrainingType constrainingType) { + // The sample CRUD implementation does not support constrainingTypes + } + + public void setURI(String uri) { + // The sample CRUD implementation does not have a URI + } + + public boolean isUnresolved() { + // The sample CRUD implementation is always resolved + return false; + } + + public void setUnresolved(boolean unresolved) { + // The sample CRUD implementation is always resolved + } + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java new file mode 100644 index 0000000000..b212ee3c9b --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud.provider; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; + +import crud.backend.ResourceManager; + + +/** + * Implements an invoker for CRUD component implementations. + * + * The invoker is responsible for handling invocations of a business operation. + * Input business data is passed to the invoke method in a Message object. + * The invoke method is responsible for handling the invocation and returning a Message with + * the output business data. + * + * In this example we are simply delegating the CRUD operation invocations to the + * corresponding methods on our fake resource manager class. + * + * More sophisticated invokers can delegate the invocation to an implementation artifact directly + * (for example a Java class using reflection as in the implementation-pojo sample) or call a runtime + * engine like a BPEL engine or an XQuery engine for example (this is what the Tuscany + * implementation-bpel and implementation-xquery extensions do). + */ +class CRUDImplementationInvoker implements Invoker { + private Operation operation; + private ResourceManager resourceManager; + + CRUDImplementationInvoker(Operation operation, ResourceManager resourceManager) { + this.operation = operation; + this.resourceManager = resourceManager; + } + + public Message invoke(Message msg) { + try { + Object[] args = msg.getBody(); + Object resp = null; + + if (operation.getName().equals("create")) { + resp = resourceManager.createResource(args[0]); + + } else if (operation.getName().equals("retrieve")) { + resp = resourceManager.retrieveResource((String)args[0]); + + } else if (operation.getName().equals("update")) { + resp = resourceManager.updateResource((String)args[0], args[1]); + + } else if (operation.getName().equals("delete")) { + resourceManager.deleteResource((String)args[0]); + } + + msg.setBody(resp); + } catch (Exception e) { + msg.setFaultBody(e.getCause()); + } + return msg; + } + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java new file mode 100644 index 0000000000..8f11f9d910 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package crud.provider; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +import crud.CRUDImplementation; +import crud.backend.ResourceManager; + + +/** + * An implementation provider for sample CRUD implementations. + * + * The implementation provider is responsible for handling the lifecycle of a component + * implementation and creating operation invokers for the service operations provided + * by the implementation. + * + * The start() and stop() methods are called when a component is started + * and stopped. + * + * The createInvoker method is called for each operation provided by the component + * implementation. The implementation provider can create an invoker and initialize it + * at that time to minimize the amount of work to be performed on each invocation. + */ +class CRUDImplementationProvider implements ImplementationProvider { + + private RuntimeComponent component; + private CRUDImplementation implementation; + + /** + * Constructs a new CRUD implementation. + */ + CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) { + this.component = component; + this.implementation = implementation; + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory())); + return invoker; + } + + public boolean supportsOneWayInvocation() { + return false; + } + + public void start() { + System.out.println("Starting " + component.getName()); + } + + public void stop() { + System.out.println("Stopping " + component.getName()); + } + +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java new file mode 100644 index 0000000000..4566cb7155 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package crud.provider; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +import crud.CRUDImplementation; +import crud.provider.CRUDImplementationProvider; + + +/** + * A factory for CRUD implementation providers. + * + * The factory is called to create an implementation provider for each component using + * the CRUD implementation. + */ +public class CRUDImplementationProviderFactory implements ImplementationProviderFactory { + + /** + * Constructs a new CRUD implementation. + */ + public CRUDImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) { + return new CRUDImplementationProvider(component, implementation); + } + + public Class getModelType() { + return CRUDImplementation.class; + } +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory new file mode 100644 index 0000000000..3cf5de5fa1 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the implementation model factory +crud.impl.CRUDImplementationFactoryImpl diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..17c98cf706 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud#implementation.crud,model=crud.CRUDImplementation,factory=crud.CRUDImplementationFactory diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema new file mode 100644 index 0000000000..527c626418 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# URI of the XML schema to be used for validation +sample-implementation-crud.xsd diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..6ce605197a --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the implementation extension +crud.provider.CRUDImplementationProviderFactory;model=crud.CRUDImplementation diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd new file mode 100644 index 0000000000..447e31bf93 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/java/sca/contrib/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java new file mode 100644 index 0000000000..0bb5cfc361 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import crud.CRUD; + +/** + * Tests the CRUD implementation extension. + */ +public class CRUDTestCase extends TestCase { + + private SCADomain scaDomain; + private CRUD crudService; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("crud.composite"); + crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCRUD() throws Exception { + String id = crudService.create("ABC"); + Object result = crudService.retrieve(id); + assertEquals("ABC", result); + + crudService.update(id, "EFG"); + result = crudService.retrieve(id); + assertEquals("EFG", result); + + crudService.delete(id); + result = crudService.retrieve(id); + assertNull(result); + } +} diff --git a/java/sca/contrib/samples/implementation-crud-extension/src/test/resources/crud.composite b/java/sca/contrib/samples/implementation-crud-extension/src/test/resources/crud.composite new file mode 100644 index 0000000000..18745033bb --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud-extension/src/test/resources/crud.composite @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-crud/README b/java/sca/contrib/samples/implementation-crud/README new file mode 100644 index 0000000000..50da631c04 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/README @@ -0,0 +1,113 @@ +Implementation CRUD Sample Client +================================= +This sample demonstrates how to use the new implementation extension, +implementation-crud-extension. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens, open a command prompt, +navigate to this sample directory, and do + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;..\implementation-crud-extension\target\sample-implementation-crud-extension.jar;target\sample-implementation-crud.jar crud.client.CRUDClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:../implementation-crud-extension/target/sample-implementation-crud-extension.jar:target/sample-implementation-crud.jar crud.client.CRUDClient + +This looks like a long command. The three things we add to the classpath are + +tuscany-sca-manifest.jar - all of the standard Tuscany SCA + runtime and extension classes +sample-implementation-crud-extension.jar - the new crud implementation + extension +sample-implementation-crud.jar - the application that uses the crud + implementation + +Sample Overview +--------------- +This sample contains a client application for a CRUD implementation type that +shows how to create new implementation types. See the README for the +mplementation-crud-extension sample for details of this implementation type. + +implementation-crud/ + src/ + main/ + java/ + crud/ + client/ + CRUDClient.java - sample client + resources/ + crud.composite - the SCA assembly used by this sample + + test/ + java/ + crud/ + client/ + CRUDTestCase.java - sample JUnit test case for the sample client + + implementation-crud.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd implementation-crud +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Starting CRUDServiceComponent + [java] create(ABC) in tmp + [java] retrieve(0) + [java] Result from create: ABC + [java] update(0) + [java] retrieve(0) + [java] Result from update: EFG + [java] delete(0) + [java] retrieve(0) + [java] Result from delete: null + [java] Stopping CRUDServiceComponent + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and +run using Maven as follows. + +cd implementation-crud +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running crud.client.CRUDTestCase +Starting CRUDServiceComponent +create(ABC) in tmp +retrieve(0) +update(0) +retrieve(0) +delete(0) +retrieve(0) +Stopping CRUDServiceComponent +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.641 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/implementation-crud/build.xml b/java/sca/contrib/samples/implementation-crud/build.xml new file mode 100644 index 0000000000..10b26b5a94 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/build.xml @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-crud/implementation-crud.png b/java/sca/contrib/samples/implementation-crud/implementation-crud.png new file mode 100644 index 0000000000..a292037e7a Binary files /dev/null and b/java/sca/contrib/samples/implementation-crud/implementation-crud.png differ diff --git a/java/sca/contrib/samples/implementation-crud/implementation-crud.svg b/java/sca/contrib/samples/implementation-crud/implementation-crud.svg new file mode 100644 index 0000000000..dbb37be208 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/implementation-crud.svg @@ -0,0 +1,135 @@ + + + + + + + + + + image/svg+xml + + + + + + + + crud + + CRUDServiceComponent + CRUD + diff --git a/java/sca/contrib/samples/implementation-crud/pom.xml b/java/sca/contrib/samples/implementation-crud/pom.xml new file mode 100644 index 0000000000..3fb4252e92 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-implementation-crud + Apache Tuscany SCA CRUD Implementation Extension Sample Client + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + sample-implementation-crud-extension + 2.0-SNAPSHOT + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java b/java/sca/contrib/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java new file mode 100644 index 0000000000..ea87cb3001 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud.client; + + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import crud.CRUD; + +/** + * A sample client that shows how to create an SCA domain, get a service, and + * invoke service methods of a CRUD component. + * + * The CRUD component uses an implementation extension + * from module implementation-crud-extension. + * + * @version $Rev$ $Date$ + */ +public class CRUDClient { + + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("crud.composite"); + CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); + + String id = crudService.create("ABC"); + + Object result = crudService.retrieve(id); + System.out.println("Result from create: " + result); + + crudService.update(id, "EFG"); + result = crudService.retrieve(id); + System.out.println("Result from update: " + result); + + crudService.delete(id); + result = crudService.retrieve(id); + System.out.println("Result from delete: " + result); + + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/implementation-crud/src/main/resources/crud.composite b/java/sca/contrib/samples/implementation-crud/src/main/resources/crud.composite new file mode 100644 index 0000000000..18745033bb --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/src/main/resources/crud.composite @@ -0,0 +1,30 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java b/java/sca/contrib/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java new file mode 100644 index 0000000000..7e0476a8b1 --- /dev/null +++ b/java/sca/contrib/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package crud.client; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import crud.CRUD; + + +/** + * Tests the sample crud composite. + */ +public class CRUDTestCase extends TestCase { + + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("crud.composite"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); + + String id = crudService.create("ABC"); + Object result = crudService.retrieve(id); + assertEquals(result, "ABC"); + + crudService.update(id, "EFG"); + result = crudService.retrieve(id); + assertEquals(result, "EFG"); + + crudService.delete(id); + result = crudService.retrieve(id); + assertNull(result); + } +} diff --git a/java/sca/contrib/samples/implementation-notification/README b/java/sca/contrib/samples/implementation-notification/README new file mode 100644 index 0000000000..7adfa4e5dc --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/README @@ -0,0 +1,97 @@ +Notification Implementation Sample +=============================== + +This sample illustrates the use of + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows, use following command: + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-notification.jar notification.TrafficAdvisoryClient + +on *nix, use following command: + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-notification.jar notification.TrafficAdvisoryClient + +OR you can also use Maven to test: + +mvn test + +Sample Overview +--------------- + +This sample consists of a single composite that contains a notification component, +a producer component and two consumer components. Take a look at the composite file +or the .svg file which shows the composite file in pictorial form. The notification +component has an that refers to the component type +that defines the TrafficAdvisory java interface. This interface indicates the +makeup of the messages being sent and received and is also implemented by the +consumer components. + +Sample directory structure: + +implementation-notification/ + src/ + main/ + java/ + notification/ + TestCaseProducer.java - interface for the producer component + TrafficAdvisory.java - interface for the notification and consumer components + TrafficAdvisoryConsumer.java - implementation for the consumer components + TrafficAdvisoryProducer.java - implementation for the producer component + test/ + java/ + notification/ + TrafficAdvisoryTestCase.java - JUnit test case + resources/ + TrafficAdvisoryNotification.componentType - the component type referred to by + + TrafficAdvisoryNotification.composite - the main composite including producer, + notification component, and consumers + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd implementation-notification +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Consumer [Consumer1] received report: Nothing to report today + [java] Consumer [Consumer2] received report: Nothing to report today + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd implementation-notification +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running notification.TrafficAdvisoryTestCase +Consumer [Consumer1] received report: Nothing to report today +Consumer [Consumer2] received report: Nothing to report today +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.742 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/implementation-notification/build.xml b/java/sca/contrib/samples/implementation-notification/build.xml new file mode 100644 index 0000000000..110c7b84c1 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-notification/implementation-notification.png b/java/sca/contrib/samples/implementation-notification/implementation-notification.png new file mode 100644 index 0000000000..0b7ee34bf7 Binary files /dev/null and b/java/sca/contrib/samples/implementation-notification/implementation-notification.png differ diff --git a/java/sca/contrib/samples/implementation-notification/pom.xml b/java/sca/contrib/samples/implementation-notification/pom.xml new file mode 100644 index 0000000000..0ebb3ff7a3 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/pom.xml @@ -0,0 +1,76 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-implementation-notification + Apache Tuscany SCA Notification Implementation Sample + 2.0-SNAPSHOT + A sample illustrating use of implementation.notification + + + + org.apache.tuscany.sca + tuscany-implementation-notification + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + test + + + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + install + + diff --git a/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java new file mode 100644 index 0000000000..bf8c72e0ce --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +public interface TestCaseProducer { + + public void produceTrafficNotification(String report); +} diff --git a/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java new file mode 100644 index 0000000000..7bbfda2122 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +public interface TrafficAdvisory { + + void trafficNotification(String report); +} diff --git a/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java new file mode 100644 index 0000000000..da32bab58d --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +import notification.TestCaseProducer; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class TrafficAdvisoryClient { + + public static void main(String[] args) throws Exception { + try { + SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); + + testCaseProducer.produceTrafficNotification("Nothing to report today"); + + domain.close(); + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + else { + throw new Exception(e); + } + } + } +} diff --git a/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java new file mode 100644 index 0000000000..17d7933d9e --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * @version $Rev$ $Date$ + */ +@Service(TrafficAdvisory.class) +@Scope("COMPOSITE") +public class TrafficAdvisoryConsumer implements TrafficAdvisory { + + @Property + protected String name; + + public void trafficNotification(String report) { + + System.out.println("Consumer [" + name + "] received report: " + report); + } +} diff --git a/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java new file mode 100644 index 0000000000..e16b509993 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +@Service(TestCaseProducer.class) +@Scope("COMPOSITE") +public class TrafficAdvisoryProducer implements TestCaseProducer { + + @Reference + protected TrafficAdvisory destination; + + public void produceTrafficNotification(String report) { + + destination.trafficNotification(report); + } +} diff --git a/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType new file mode 100644 index 0000000000..873e200613 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite new file mode 100644 index 0000000000..bbf2281352 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + Consumer1 + + + + + Consumer2 + + + diff --git a/java/sca/contrib/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java b/java/sca/contrib/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java new file mode 100644 index 0000000000..719141c94b --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package notification; + +import junit.framework.TestCase; + +import notification.TestCaseProducer; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class TrafficAdvisoryTestCase extends TestCase { + + private SCADomain domain; + private TestCaseProducer testCaseProducer; + + public void testTrafficAdvisoryNotification() throws Exception { + try { + testCaseProducer.produceTrafficNotification("Nothing to report today"); + } catch(Throwable e) { + e.printStackTrace(); + } + } + + @Override + protected void setUp() throws Exception { + try { + domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); + testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + else { + throw new Exception(e); + } + } + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } +} diff --git a/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType b/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType new file mode 100644 index 0000000000..873e200613 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite b/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite new file mode 100644 index 0000000000..bbf2281352 --- /dev/null +++ b/java/sca/contrib/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + Consumer1 + + + + + Consumer2 + + + diff --git a/java/sca/contrib/samples/implementation-pojo-extension/README b/java/sca/contrib/samples/implementation-pojo-extension/README new file mode 100644 index 0000000000..3b201779e1 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/README @@ -0,0 +1,70 @@ +Implementation POJO Sample +========================== +This sample demonstrates how new implementation types are constructed for +Apache Tuscany SCA. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +Sample Overview +--------------- +This sample contains a POJO implementation type as an example of how to create +new implementation types. + +implementation-pojo-extension/ + src/ + main/ + java/ + pojo/ - implementation model interfaces + impl/ - implementations of the model interfaces + provider/ - runtime implementation + resources/ + META-INF/ + services/ - declares the extension + test/ + java/ + helloworld/ + HelloWorldTestCase.java - JUnit test case + resources/ + helloworld.composite - the SCA assembly used during unit testing + + build.xml - the Ant build file + pom.xml - the Maven build file + +Building The Sample Extension Using Ant +----------------------------------------- +With the binary distribution the sample extension can be built using Ant as +follows + +cd implementation-pojo-extension +ant compile + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built +using Maven as follows. + +cd implementation-pojo-extension +mvn + +Maven will also test that the sample extension built properly. You should see +the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running helloworld.HelloWorldTestCase +Initializing POJO +Initializing POJO +Executing POJO sayHello +Initializing POJO +Initializing POJO +Executing POJO sayHello +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.616 sec + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/implementation-pojo-extension/build.xml b/java/sca/contrib/samples/implementation-pojo-extension/build.xml new file mode 100644 index 0000000000..78bae79859 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/build.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-pojo-extension/pom.xml b/java/sca/contrib/samples/implementation-pojo-extension/pom.xml new file mode 100644 index 0000000000..6fa7ab7f1c --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-implementation-pojo-extension + Apache Tuscany SCA POJO Implementation Extension Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-assembly-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-interface-java-xml + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java new file mode 100644 index 0000000000..7c2f5d236f --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package pojo; + +import java.lang.reflect.Method; +import java.util.Map; + +import org.apache.tuscany.sca.assembly.Implementation; + + +/** + * Represents a POJO implementation in an SCA assembly. + * + * @version $Rev$ $Date$ + */ +public interface POJOImplementation extends Implementation { + + /** + * Returns the POJO class name + * @return + */ + public String getPOJOName(); + + /** + * Sets the POJO class name + * @param pojoName + */ + public void setPOJOName(String pojoName); + + /** + * Returns the POJO class. + * @return + */ + public Class getPOJOClass(); + + /** + * Sets the POJO class. + * @param pojoClass + */ + public void setPOJOClass(Class pojoClass); + + /** + * Returns the POJO's methods. + * @return + */ + public Map getMethods(); + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java new file mode 100644 index 0000000000..bbcfb3d0dc --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package pojo; + + +/** + * Factory for the POJO implementation model. + * + * @version $Rev$ $Date$ + */ +public interface POJOImplementationFactory { + + /** + * Creates a new POJO implementation model object. + * @return a new POJO implementation model object + */ + POJOImplementation createPOJOImplementation(); + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java new file mode 100644 index 0000000000..0dad270a6c --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package pojo.impl; + +import pojo.POJOImplementation; +import pojo.POJOImplementationFactory; + +/** + * A factory for the POJO implementation model. + * + * @version $Rev$ $Date$ + */ +public class POJOImplementationFactoryImpl implements POJOImplementationFactory { + + public POJOImplementation createPOJOImplementation() { + return new POJOImplementationImpl(); + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java new file mode 100644 index 0000000000..f2d6871039 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java @@ -0,0 +1,155 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package pojo.impl; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.tuscany.sca.assembly.ConstrainingType; +import org.apache.tuscany.sca.assembly.Property; +import org.apache.tuscany.sca.assembly.Reference; +import org.apache.tuscany.sca.assembly.Service; + +import pojo.POJOImplementation; + + +/** + * Represents a POJO implementation in an SCA assembly. + * + * @version $Rev$ $Date$ + */ +class POJOImplementationImpl implements POJOImplementation { + + private String pojoName; + private Class pojoClass; + private String uri; + private Map methods; + private List services = new ArrayList(); + private List references = new ArrayList(); + private List properties = new ArrayList(); + private boolean unresolved; + + POJOImplementationImpl() { + } + + /** + * Returns the POJO class name + * @return + */ + public String getPOJOName() { + return pojoName; + } + + /** + * Sets the POJO class name + * @param pojoName + */ + public void setPOJOName(String pojoName) { + this.pojoName = pojoName; + setURI(pojoName.replace('.', '/')); + } + + /** + * Returns the POJO class. + * @return + */ + public Class getPOJOClass() { + return pojoClass; + } + + /** + * Sets the POJO class. + * @param pojoClass + */ + public void setPOJOClass(Class pojoClass) { + this.pojoClass = pojoClass; + setPOJOName(pojoClass.getName()); + + // Index the POJO's methods + methods = new HashMap(); + Method[] m = pojoClass.getMethods(); + for (int i = 0; i < m.length; i++) { + methods.put(m[i].getName(), m[i]); + } + } + + /** + * Returns the POJO's methods. + * @return + */ + public Map getMethods() { + return methods; + } + + public ConstrainingType getConstrainingType() { + // The sample POJO implementation does not support constrainingTypes + return null; + } + + public List getProperties() { + return properties; + } + + public List getServices() { + return services; + } + + public List getReferences() { + return references; + } + + public String getURI() { + return uri; + } + + public void setConstrainingType(ConstrainingType constrainingType) { + // The sample POJO implementation does not support constrainingTypes + } + + public void setURI(String uri) { + this.uri = uri; + } + + public boolean isUnresolved() { + return unresolved; + } + + public void setUnresolved(boolean unresolved) { + this.unresolved = unresolved; + } + + @Override + public int hashCode() { + return uri.hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof POJOImplementationImpl) { + return ((POJOImplementationImpl)obj).getURI().equals(uri); + } else { + return false; + } + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java new file mode 100644 index 0000000000..44a2cc0aa8 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package pojo.impl; + +import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.assembly.Service; +import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ClassReference; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.monitor.Monitor; +import org.apache.tuscany.sca.policy.PolicyFactory; + +import pojo.POJOImplementation; +import pojo.POJOImplementationFactory; + +/** + * Implements a STAX based artifact processor for POJO implementations. + * + * The artifact processor is responsible for processing + * elements in SCA assembly XML composite files and populating the POJO + * implementation model, resolving its references to other artifacts in the SCA + * contribution, and optionally write the model back to SCA assembly XML. + */ +public class POJOImplementationProcessor implements StAXArtifactProcessor { + private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo"); + + private AssemblyFactory assemblyFactory; + private JavaInterfaceFactory javaFactory; + private POJOImplementationFactory pojoImplementationFactory; + private PolicyFactory policyFactory; + private PolicyAttachPointProcessor policyProcessor; + + public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { + + // Get the assembly and Java interface factories as we'll need them to + // create model objects + assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); + policyFactory = modelFactories.getFactory(PolicyFactory.class); + pojoImplementationFactory = modelFactories.getFactory(POJOImplementationFactory.class); + policyProcessor = new PolicyAttachPointProcessor(policyFactory); + } + + public QName getArtifactType() { + // Returns the qname of the XML element processed by this processor + return IMPLEMENTATION_POJO; + } + + public Class getModelType() { + // Returns the type of model processed by this processor + return POJOImplementation.class; + } + + public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + + // Read an element + POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation(); + + // Read policies + policyProcessor.readPolicies(implementation, reader); + + // Read the POJO class attribute. + String className = reader.getAttributeValue(null, "class"); + implementation.setPOJOName(className); + + // Mark the POJO model unresolved to track the fact that it's not + // completely initialized, its class is not loaded yet and services + // and references not initialized either + implementation.setUnresolved(true); + + // Skip to end element + while (reader.hasNext()) { + if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) { + break; + } + } + + return implementation; + } + + public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException { + + // Resolve the POJO implementation + + // First resolve its class + ClassReference classReference = new ClassReference(implementation.getPOJOName()); + classReference = resolver.resolveModel(ClassReference.class, classReference); + Class pojoClass = classReference.getJavaClass(); + if (pojoClass == null) { + throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName()); + } + implementation.setPOJOClass(pojoClass); + + // Check to see if we have a .componentType file describing the POJO class + ComponentType componentType = assemblyFactory.createComponentType(); + componentType.setUnresolved(true); + componentType.setURI(implementation.getURI() + ".componentType"); + componentType = resolver.resolveModel(ComponentType.class, componentType); + if (!componentType.isUnresolved()) { + + // We have a component type description, merge it into the POJO model + implementation.getServices().addAll(componentType.getServices()); + implementation.getReferences().addAll(componentType.getReferences()); + implementation.getProperties().addAll(componentType.getProperties()); + + } else { + + // We have no component type description, simply introspect the POJO and + // create a single Service for it + Service service = assemblyFactory.createService(); + service.setName(pojoClass.getSimpleName()); + JavaInterface javaInterface; + try { + javaInterface = javaFactory.createJavaInterface(pojoClass); + } catch (InvalidInterfaceException e) { + throw new ContributionResolveException(e); + } + JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); + interfaceContract.setInterface(javaInterface); + service.setInterfaceContract(interfaceContract); + implementation.getServices().add(service); + } + + // Mark the implementation resolved now + implementation.setUnresolved(false); + } + + public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { + + // Write element + policyProcessor.writePolicyPrefixes(implementation, writer); + writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart()); + policyProcessor.writePolicyAttributes(implementation, writer); + + if (implementation.getPOJOName() != null) { + writer.writeAttribute("class", implementation.getPOJOName()); + } + + writer.writeEndElement(); + } +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java new file mode 100644 index 0000000000..0654cb93e5 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package pojo.provider; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.oasisopen.sca.ServiceRuntimeException; + +/** + * Implements an invoker for POJO component implementations. + * + * The invoker is responsible for handling invocations of a business operation. + * Input business data is passed to the invoke method in a Message object. + * The invoke method is responsible for handling the invocation and returning a Message with + * the output business data. + * + * In this example we are simply delegating the operation invocations to the + * corresponding methods on the POJO implementation class using Java reflection. + * + * Depending on the type of implementation being handled, more sophisticated invokers can + * use other techniques to delegate the invocation to the implementation artifact directly, call a + * runtime engine like a BPEL engine or an XQuery engine (this is what the Tuscany + * implementation-bpel and implementation-xquery extensions do) or just completely handle the + * invocation in the invoker itself if the implementation has a fixed behavior for example. + */ +class POJOImplementationInvoker implements Invoker { + + private Object pojoInstance; + private Method method; + + POJOImplementationInvoker(Object pojoInstance, Operation operation, Method method) { + this.pojoInstance = pojoInstance; + this.method = method; + } + + public Message invoke(Message msg) { + try { + msg.setBody(method.invoke(pojoInstance, (Object[])msg.getBody())); + } catch (InvocationTargetException e) { + msg.setFaultBody(e); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + return msg; + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java new file mode 100644 index 0000000000..30a9885ea9 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package pojo.provider; + +import java.lang.reflect.Method; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; +import org.oasisopen.sca.ServiceRuntimeException; + +import pojo.POJOImplementation; + +/** + * An implementation provider for sample CRUD implementations. + * + * The implementation provider is responsible for handling the lifecycle of a component + * implementation and creating operation invokers for the service operations provided + * by the implementation. + * + * The start() and stop() methods are called when a component is started + * and stopped. In this example we are using that opportunity to call init and destroy methods + * on the POJO instance if these methods exist. + * + * The createInvoker method is called for each operation provided by the component + * implementation. The implementation provider can create an invoker and initialize it + * at that time to minimize the amount of work to be performed on each invocation. + * + * For example here we are looking up the Java method corresponding to the service operation + * at passing it to the invoker constructor. This way the invoker won't have to lookup the Java + * method on each invocation. + */ +class POJOImplementationProvider implements ImplementationProvider { + + private POJOImplementation implementation; + private Object pojoInstance; + + /** + * Constructs a new CRUD implementation. + */ + POJOImplementationProvider(RuntimeComponent component, POJOImplementation implementation) { + this.implementation = implementation; + + // Create a new instance of the POJO + try { + pojoInstance = implementation.getPOJOClass().newInstance(); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } + + public void start() { + try { + // Invoke the POJO's init method + Method initMethod = implementation.getMethods().get("init"); + if (initMethod != null) { + initMethod.invoke(pojoInstance); + } + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } + + public void stop() { + try { + // Invoke the POJO's destroy method + Method destroyMethod = implementation.getMethods().get("destroy"); + if (destroyMethod != null) { + destroyMethod.invoke(pojoInstance); + } + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } finally { + pojoInstance = null; + } + } + + public Invoker createInvoker(RuntimeComponentService service, Operation operation) { + Method method = implementation.getMethods().get(operation.getName()); + POJOImplementationInvoker invoker = new POJOImplementationInvoker(pojoInstance, operation, method); + return invoker; + } + + public boolean supportsOneWayInvocation() { + return false; + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java new file mode 100644 index 0000000000..22f2be09e9 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package pojo.provider; + +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.ImplementationProvider; +import org.apache.tuscany.sca.provider.ImplementationProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +import pojo.POJOImplementation; + +/** + * A factory for POJO implementation providers. + */ +public class POJOImplementationProviderFactory implements ImplementationProviderFactory { + + public POJOImplementationProviderFactory(ExtensionPointRegistry registry) { + } + + public Class getModelType() { + // Returns the type of model processed by this processor + return POJOImplementation.class; + } + + public ImplementationProvider createImplementationProvider(RuntimeComponent component, POJOImplementation implementation) { + return new POJOImplementationProvider(component, implementation); + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..8337e81c5f --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +pojo.impl.POJOImplementationProcessor;qname=http://pojo#implementation.pojo,model=pojo.POJOImplementation,factory=pojo.POJOImplementationFactory diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema new file mode 100644 index 0000000000..64dd230a15 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# URI of the XML schema to be used for validation +sample-implementation-pojo.xsd diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory new file mode 100644 index 0000000000..b30ea3b9cf --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the implementation extension +pojo.provider.POJOImplementationProviderFactory;model=pojo.POJOImplementation diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory new file mode 100644 index 0000000000..075af98240 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for implementation model factory +pojo.impl.POJOImplementationFactoryImpl diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd new file mode 100644 index 0000000000..c9d170770b --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..cc32929f09 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +public interface HelloWorld { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..0580e30aba --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +public class HelloWorldImpl { + + public void init() { + System.out.println("Initializing POJO"); + } + + public void destroy() { + System.out.println("Destroying POJO"); + } + + public String sayHello(String name) { + System.out.println("Executing POJO sayHello"); + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java new file mode 100644 index 0000000000..69ab1f567e --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +public class HelloWorldImpl2 { + + public void init() { + System.out.println("Initializing POJO"); + } + + public void destroy() { + System.out.println("Destroying POJO"); + } + + public String sayHello(String name) { + System.out.println("Executing POJO sayHello"); + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..d8b5f41adc --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Tests the POJO implementation extension. + */ +public class HelloWorldTestCase extends TestCase { + + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testHello() throws Exception { + HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); + assertEquals("Hello petra", helloworld.sayHello("petra")); + } + + public void testHello2() throws Exception { + HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2"); + assertEquals("Hello petra", helloworld.sayHello("petra")); + } +} diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType b/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType new file mode 100644 index 0000000000..a92c5ab8db --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType @@ -0,0 +1,26 @@ + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite b/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..c38094dfc9 --- /dev/null +++ b/java/sca/contrib/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/loanapplication/pom.xml b/java/sca/contrib/samples/loanapplication/pom.xml new file mode 100644 index 0000000000..ad76cde4f1 --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-loanapplication + Apache Tuscany SCA Loan Application Conversation Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java new file mode 100644 index 0000000000..4fedb70782 --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +public class LoanApplication { + + private String customerName; + private float loanAmount; + + public LoanApplication(String customerName, float loanAmount) { + this.customerName = customerName; + this.loanAmount = loanAmount; + } + + @Override + public String toString() { + return "[Customer: " + customerName + ", loan amount: " + + loanAmount + "]"; + } +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java new file mode 100644 index 0000000000..5183ece867 --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + + +public class LoanApplicationClient { + + public static void main(String[] args) throws Exception { + SCADomain domain = SCADomain.newInstance("loanapplication.composite"); + + // Locate the MyClient component and invoke it + LoanClient loanClient = domain.getService(LoanClient.class, "LoanClientComponent"); + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println(loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + + domain.close(); + } +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClient.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClient.java new file mode 100644 index 0000000000..7e4438bbff --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClient.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +public interface LoanClient { + + void applyForLoan(String customerName, float amount); + boolean isApproved(); + boolean isCancelled(); + String displayLoan(); + void cancelLoan(); + void closeLoan(); +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java new file mode 100644 index 0000000000..023199b14b --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class LoanClientImpl implements LoanClient { + + private LoanService loanService; + + @Reference + public void setLoanService(LoanService loanService) { + this.loanService = loanService; + } + + public void applyForLoan(String customerName, float amount) { + loanService.apply(new LoanApplication(customerName, amount)); + } + + public boolean isApproved() { + if (loanService.getLoanStatus() == null) { + return false; + } + return loanService.getLoanStatus().equals("approved"); + } + + public boolean isCancelled() { + if (loanService.getLoanStatus() == null) { + return false; + } + return loanService.getLoanStatus().equals("cancelled"); + } + + public String displayLoan() { + return loanService.display(); + } + + public void cancelLoan() { + loanService.cancelApplication(); + } + + public void closeLoan() { + loanService.close(); + } +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanService.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanService.java new file mode 100644 index 0000000000..8d16b04caf --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanService.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import org.oasisopen.sca.annotation.Conversational; +import org.oasisopen.sca.annotation.EndsConversation; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +@Conversational +@Remotable +public interface LoanService { + + void apply(LoanApplication application); + + void lockCurrentRate(int termInYears); + + @OneWay + void cancelApplication(); + + String getLoanStatus(); + + String display(); + + @EndsConversation + void close(); +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java new file mode 100644 index 0000000000..a88dc0b56b --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.ConversationID; +import org.oasisopen.sca.annotation.Scope; + +@Scope("CONVERSATION") +@AllowsPassByReference +public class LoanServiceImpl implements LoanService { + + private LoanApplication application; + private String status; + private int termLocked = 0; + @ConversationID + protected String conversationID; + + public void apply(LoanApplication application) { + this.application = application; + status = "open"; + } + + public void lockCurrentRate(int termInYears) { + termLocked = termInYears; + status = "locked"; + } + + public void cancelApplication() { + status = "cancelled"; + } + + public String getLoanStatus() { + return status; + } + + public String display() { + return "Loan application: " + application + ", term: " + + termLocked + ", status: " + status + + ", conversationID: " + conversationID; + } + + public void close() { + this.application = null; + this.status = "closed"; + } +} diff --git a/java/sca/contrib/samples/loanapplication/src/main/resources/loanapplication.composite b/java/sca/contrib/samples/loanapplication/src/main/resources/loanapplication.composite new file mode 100644 index 0000000000..3aa8d030b7 --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/main/resources/loanapplication.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java b/java/sca/contrib/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java new file mode 100644 index 0000000000..e88e48a53a --- /dev/null +++ b/java/sca/contrib/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package loanapplication; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LoanApplicationTestCase extends TestCase { + + private LoanClient loanClient; + private SCADomain domain; + + @Override + protected void setUp() throws Exception { + domain = SCADomain.newInstance("loanapplication.composite"); + + loanClient = domain.getService(LoanClient.class, "LoanClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + domain.close(); + } + + public void test() throws Exception { + try { + loanClient.applyForLoan("John Doe", 1000.0f); + System.out.println("Applied: " + loanClient.displayLoan()); + System.out.println("Loan approved: " + loanClient.isApproved()); + loanClient.cancelLoan(); + System.out.println("Sleeping to let cancel complete ..."); + Thread.sleep(500); + if (!loanClient.isCancelled()) { + fail("Loan should be cancelled"); + } + System.out.println("Cancelled: " + loanClient.displayLoan()); + loanClient.closeLoan(); + + /* This is a mistake, after @EndsConversation, a new conversation is + * started automatically, so we should not get TargetNotFoundException. + * Keep this for the timeout case, where we should get the exception + try { + System.out.println("Trying to use the closed loan in the ended conversation ..."); + System.out.println("Closed: " + loanClient.displayLoan()); + fail("Target should not be found"); + } catch(TargetNotFoundException e) { + System.out.println("Target not found as expected"); + } + */ + + // Now check that a new conversation's loan is not cancelled + + if (loanClient.isCancelled()) { + fail("Loan should not be cancelled"); + } + } catch(Throwable e) { + e.printStackTrace(); + if (e instanceof Exception) { + throw (Exception)e; + } + if (e instanceof Error) { + throw (Error)e; + } + } + } +} diff --git a/java/sca/contrib/samples/osgi-supplychain/README b/java/sca/contrib/samples/osgi-supplychain/README new file mode 100644 index 0000000000..11fecf2ae8 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/README @@ -0,0 +1,161 @@ +osgi-supplychain Sample +======================= + +The Tuscany OSGi supply chain sample shows using the Tuscany SCA runtime in a J2SE environment executing the SCA asynchronous API with OSGi and Java implementation types. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +In the directory samples\osgi-supplychain use the JDK 1.5 java command to run the class supplychain.SupplyChainClient + +Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-osgi-supplychain.jar supplychain.SupplyChainClient +Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-osgi-supplychain.jar supplychain.SupplyChainClient + +Results +---------- +The sample when run should simply display on the standard output some startup messages followed by: + +Work thread Thread[Thread-1,5,main] - Order, submitted, fulfilled, shipped + + +Sample Overview +--------------- + +The sample provides a Customer service with a purchaseGoods operation +and a notifyShipment operation annotated with the SCA @OneWay annotation. +The SupplyChainClient exercises this interface by calling the +purchaseGoods operation. This results in messages passing to +the Retailer, Warehouse, and Shipper components and the result returned +to the Customer service on a separate callback thread. The Customer +and Shipper components are implemented as OSGi bundles which use +implementation.osgi, while the Retailer and Warehouse components are +implemented using implementation.java. + + +src ++---main + +---java + ¦ +---supplychain + ¦ OSGiBundleImpl.java + ¦ SupplyChainClient.java + ¦ +---customer + ¦ Customer.java + ¦ JavaCustomerComponentImpl.java + ¦ OSGiCustomerComponentImpl.java + ¦ OSGiCustomerImpl.java + ¦ +---retailer + ¦ Retailer.java + ¦ JavaRetailerComponentImpl.java + ¦ OSGiRetailerComponentImpl.java + ¦ OSGiRetailerImpl.java + ¦ +---shipper + ¦ Shipper.java + ¦ JavaShipperComponentImpl.java + ¦ OSGiShipperComponentImpl.java + ¦ OSGiShipperImpl.java + ¦ +---warehouse + ¦ Warehouse.java + ¦ JavaWarehouseComponentImpl.java + ¦ OSGiWarehouseComponentImpl.java + ¦ OSGiWarehouseImpl.java + ¦ + +---resources + ¦ +---osgi + ¦ Customer.mf + ¦ Retailer.mf + ¦ Shipper.mf + ¦ Warehouse.mf + ¦ +---ds + ¦ Customer.mf + ¦ Retailer.mf + ¦ Shipper.mf + ¦ Warehouse.mf + ¦ Customer.xml + ¦ Retailer.xml + ¦ Shipper.xml + ¦ Warehouse.xml + ¦ Customer.componentType + ¦ Retailer.componentType + ¦ Shipper.componentType + ¦ Warehouse.componentType + ¦ supplychain.composite + ¦-- supplychain.ds.composite + + + build.xml - the Ant build file + pom.xml - the Maven build file + +Understanding OSGI implementation files +--------------------------------------- +Some of the files introduced by OSGI implementation are explained below. + +OSG files related to customer. java are: +OSGiCustomerComponentImpl.java: OSGi Declarative Services Implementation of the SCA Customer component. +OSGiCustomerImpl.java: OSGi Procedural Services Implementation of the SCA Customer component. + +You notice the same pattern for shipper.java, retailer.java, SupplyChainClient.java. + +The rest of OSGI related files are: +OSGiBundleImpl.java: Common code for OSGi Procedural Services Implementation of the SCA components + +resources/osgi/*.mf: Manifest files for OSGi bundles for OSGi procedural services implementation + +resources/osgi/ds/*.m:f Manifest files for OSGi bundles for OSGi declarative services implementation + +resources/osgi/ds/*.xml: OSGi Declarative services component xml files + +resources/*.componentType: Component types used by OSGi implementation provider for SCA + +resources/supplychain.composite: Composite file using OSGi and Java implementation types + +resources/supplychain.ds.composite: Composite file using OSGi (declarative services) and Java implementation types + +Building And Running The Sample Using Ant +----------------------------------------- +cd osgi-supplychain +ant compile +ant run + +you should see: +Buildfile: build.xml + +run: + [java] Main thread Thread[main,5,main] + [java] Started OSGi bundle with activator OSGiCustomerImpl + [java] Started OSGi bundle with activator OSGiShipperImpl + [java] Main thread sleeping ... + [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfi +lled, shipped + [java] Stop OSGi bundle with activator OSGiShipperImpl + [java] Stop OSGi bundle with activator OSGiCustomerImpl + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd osgi-supplychain +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running supplychain.SupplyChainClientTestCase +Started OSGi bundle with activator OSGiCustomerImpl +Started OSGi bundle with activator OSGiShipperImpl +Sleeping ... +Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shippe +d +Test complete +Stop OSGi bundle with activator OSGiShipperImpl +Stop OSGi bundle with activator OSGiCustomerImpl +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.062 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/osgi-supplychain/build-bundles.xml b/java/sca/contrib/samples/osgi-supplychain/build-bundles.xml new file mode 100644 index 0000000000..7a31e6016b --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/build-bundles.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/build.xml b/java/sca/contrib/samples/osgi-supplychain/build.xml new file mode 100644 index 0000000000..2e103e5a15 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/build.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.png b/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.png new file mode 100644 index 0000000000..2bec57ac8a Binary files /dev/null and b/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.png differ diff --git a/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.svg b/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.svg new file mode 100644 index 0000000000..43cb427944 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/osgi-supplychain.svg @@ -0,0 +1,272 @@ + + + + + + + + + + image/svg+xml + + + + + + + + supplychain + + CustomerComponent + + + RetailerComponent + + + WharehouseComponent + + + ShipperComponent + + + + + + OSGi + Java + Java + OSGi + + diff --git a/java/sca/contrib/samples/osgi-supplychain/pom.xml b/java/sca/contrib/samples/osgi-supplychain/pom.xml new file mode 100644 index 0000000000..a3140094c5 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/pom.xml @@ -0,0 +1,187 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-osgi-supplychain + Apache Tuscany SCA OSGi Supply Chain Sample + + + + + org.apache.felix + org.apache.felix.main + 1.0.4 + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-osgi + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + sample-osgi-supplychain + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + + ant + ant-trax + 1.6.5 + + + + + + create-bundles + generate-test-sources + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java new file mode 100644 index 0000000000..5f40054ada --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java @@ -0,0 +1,121 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + + +import java.lang.reflect.Field; +import java.util.Hashtable; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceEvent; +import org.osgi.framework.ServiceListener; +import org.osgi.framework.ServiceReference; + + +/** + * Common code for all OSGi bundles which dont use declarative services. + * Registers services and sets references. + */ +public class OSGiBundleImpl implements ServiceListener, BundleActivator { + + + String name; + String serviceName; + String[] references; + Class[] referenceClasses; + Field[] referenceFields; + + Class myClass; + + private BundleContext bundleContext; + + public OSGiBundleImpl(String serviceName, String... references) { + + myClass = this.getClass(); + this.name = this.getClass().getSimpleName(); + this.serviceName = serviceName; + this.references = references; + + try { + referenceClasses = new Class[references.length]; + referenceFields = new Field[references.length]; + for (int i = 0; i < references.length; i++) { + referenceFields[i] = this.getClass().getDeclaredField(references[i]); + referenceFields[i].setAccessible(true); + referenceClasses[i] = referenceFields[i].getType(); + } + + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + public void start(BundleContext bc) { + + System.out.println("Started OSGi bundle with activator " + name); + + this.bundleContext = bc; + + bundleContext.registerService(serviceName, this, new Hashtable()); + + for (int i = 0; i < references.length; i++) { + + try { + + ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName()); + if (ref != null) { + Object obj = bundleContext.getService(ref); + referenceFields[i].set(this, referenceClasses[i].cast(obj)); + } else { + String filter = "(objectclass=" + referenceClasses[i].getName() + ")"; + this.bundleContext.addServiceListener(this, filter); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public void stop(BundleContext bc) { + System.out.println("Stop OSGi bundle with activator " + name); + + } + + + public void serviceChanged(ServiceEvent event) { + try { + if (event.getType() == ServiceEvent.REGISTERED) { + + ServiceReference ref = event.getServiceReference(); + Object obj = bundleContext.getService(ref); + for (int i = 0; i < references.length; i++) { + if (referenceClasses[i].isAssignableFrom(obj.getClass())) { + referenceFields[i].set(this, referenceClasses[i].cast(obj)); + } + } + } + } catch (Throwable e) { + e.printStackTrace(); + } + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java new file mode 100644 index 0000000000..64814487cb --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import supplychain.customer.Customer; + + +/** + * This client program shows how to create an SCA runtime, start it, + * locate a Customer service component and invoke it. + */ +public class SupplyChainClient { + + public static final void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("supplychain.composite"); + Customer customer = scaDomain.getService(Customer.class, "CustomerComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + System.out.println("Main thread sleeping ..."); + Thread.sleep(1000); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java new file mode 100644 index 0000000000..b70ddede4f --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.customer; + +import org.oasisopen.sca.annotation.OneWay; + +/** + * This is the business interface of the Customer service component. + */ +public interface Customer { + + public void purchaseGoods(); + + @OneWay + public void notifyShipment(String order); + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java new file mode 100644 index 0000000000..cad0749218 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.customer; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +import supplychain.retailer.Retailer; + +/** + * This class implements the Customer service component (POJO implementation). + */ +@Service(Customer.class) +@Scope("COMPOSITE") +public class JavaCustomerComponentImpl implements Customer { + + private Retailer retailer; + + @Reference + public void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + public void purchaseGoods() { + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java new file mode 100644 index 0000000000..a1c7fce60a --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.customer; + + +import supplychain.retailer.Retailer; + +/** + * This class implements the Customer service component (OSGi declarative services implementation). + */ +public class OSGiCustomerComponentImpl implements Customer { + + + private Retailer retailer; + + + protected void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + protected void unsetRetailer(Retailer retailer) { + this.retailer = null; + } + + public void purchaseGoods() { + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java new file mode 100644 index 0000000000..4647a716c7 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.customer; + + +import supplychain.OSGiBundleImpl; +import supplychain.retailer.Retailer; + +/** + * This class implements the Customer service component (OSGi procedural services implementation). + */ +public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer { + + private Retailer retailer; + + public OSGiCustomerImpl() { + super("supplychain.customer.Customer", "retailer"); + + } + + public void purchaseGoods() { + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java new file mode 100644 index 0000000000..4c2c8d7604 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.retailer; + + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +import supplychain.warehouse.Warehouse; + +/** + * This class implements the Retailer service component (POJO implementation). + */ +@Service(Retailer.class) +@Scope("STATELESS") +public class JavaRetailerComponentImpl implements Retailer { + + private Warehouse warehouse; + + + @Reference + public void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; + } + + + public void submitOrder(String order) { + + warehouse.fulfillOrder(order + ", submitted"); + + } + + + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java new file mode 100644 index 0000000000..1b7fb15bf1 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.retailer; + +import supplychain.warehouse.Warehouse; + +/** + * This class implements the Retailer service component (OSGi declarative services implementation). + */ +public class OSGiRetailerComponentImpl implements Retailer { + + private Warehouse warehouse; + + + protected void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; + } + + protected void unsetWarehouse(Warehouse warehouse) { + this.warehouse = null; + } + + public void submitOrder(String order) { + + warehouse.fulfillOrder(order + ", submitted"); + + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java new file mode 100644 index 0000000000..e97331c06c --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.retailer; + + +import supplychain.OSGiBundleImpl; +import supplychain.warehouse.Warehouse; + +/** + * This class implements the Retailer service component (OSGi procedural services implementation). + */ +public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer { + + private Warehouse warehouse; + + public OSGiRetailerImpl() { + + super("supplychain.retailer.Retailer", "warehouse"); + } + + public void submitOrder(String order) { + warehouse.fulfillOrder(order + ", submitted"); + + } + + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java new file mode 100644 index 0000000000..1e87d59af1 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.retailer; + +/** + * This is the business interface of the Retailer service component. + */ +public interface Retailer { + + public void submitOrder(String order); + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java new file mode 100644 index 0000000000..8f1276c4e7 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.shipper; + + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +import supplychain.customer.Customer; + +/** + * This class implements the Shipper service component (POJO implementation). + */ +@Service(Shipper.class) +@Scope("COMPOSITE") +public class JavaShipperComponentImpl implements Shipper { + + private Customer customer; + + @Reference + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java new file mode 100644 index 0000000000..0f88cca213 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.shipper; + + +import supplychain.customer.Customer; + +/** + * This class implements the Shipper service component (OSGi declarative services implementation). + */ +public class OSGiShipperComponentImpl implements Shipper { + + private Customer customer; + + + protected void setCustomer(Customer customer) { + this.customer = customer; + } + + protected void unsetCustomer(Customer customer) { + this.customer = null; + } + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java new file mode 100644 index 0000000000..f55a068ede --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.shipper; + + +import supplychain.OSGiBundleImpl; +import supplychain.customer.Customer; + +/** + * This class implements the Shipper service component (OSGi procedural services implementation). + */ +public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper { + + private Customer customer; + + public OSGiShipperImpl() { + super("supplychain.shipper.Shipper", "customer"); + } + + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java new file mode 100644 index 0000000000..2514928c10 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.shipper; + +/** + * This is the business interface of the Shipper service component. + */ +public interface Shipper { + + public void processShipment(String order); + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java new file mode 100644 index 0000000000..3c0bc6aa83 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.warehouse; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +import supplychain.shipper.Shipper; + +/** + * This class implements the Warehouse service component (POJO implementation). + */ +@Service(Warehouse.class) +@Scope("STATELESS") +public class JavaWarehouseComponentImpl implements Warehouse { + + private Shipper shipper; + + + @Reference + public void setShipper(Shipper shipper) { + this.shipper = shipper; + } + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java new file mode 100644 index 0000000000..600f3f0c74 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.warehouse; + +import supplychain.shipper.Shipper; + +/** + * This class implements the Warehouse service component (OSGi declarative services implementation). + */ + +public class OSGiWarehouseComponentImpl implements Warehouse { + + private Shipper shipper; + + + protected void setShipper(Shipper shipper) { + this.shipper = shipper; + } + + protected void unsetShipper(Shipper shipper) { + this.shipper = null; + } + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + + } + + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java new file mode 100644 index 0000000000..b8bca97bd0 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.warehouse; + + +import supplychain.OSGiBundleImpl; +import supplychain.shipper.Shipper; + +/** + * This class implements the Warehouse service componentm (OSGi procedural services implementation). + */ + +public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse { + + private Shipper shipper; + + public OSGiWarehouseImpl() { + super("supplychain.warehouse.Warehouse", "shipper"); + } + + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + + } + + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java new file mode 100644 index 0000000000..6f1f6b8730 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain.warehouse; + +/** + * This is the business interface of the Warehouse service component. + */ +public interface Warehouse { + + public void fulfillOrder(String order); + +} diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Customer.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Customer.componentType new file mode 100644 index 0000000000..5c61a0961c --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Customer.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType new file mode 100644 index 0000000000..87a184d968 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType new file mode 100644 index 0000000000..872ab6601a --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSShipper.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSShipper.componentType new file mode 100644 index 0000000000..57fcbbc5d1 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSShipper.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType new file mode 100644 index 0000000000..75fa8029f7 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Retailer.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Retailer.componentType new file mode 100644 index 0000000000..15185f2bf9 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Retailer.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Shipper.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Shipper.componentType new file mode 100644 index 0000000000..675597d80b --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Shipper.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Warehouse.componentType b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Warehouse.componentType new file mode 100644 index 0000000000..6e1ac3e5a9 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/Warehouse.componentType @@ -0,0 +1,28 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf new file mode 100644 index 0000000000..88d79e5219 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Customer +Bundle-SymbolicName: supplychain.customer.Customer +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + supplychain.retailer +Export-Package: supplychain.customer +Bundle-Activator: supplychain.customer.OSGiCustomerImpl + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf new file mode 100644 index 0000000000..d95ef5d582 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Retailer +Bundle-SymbolicName: supplychain.retailer.Retailer +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + supplychain.warehouse +Export-Package: supplychain.retailer +Bundle-Activator: supplychain.retailer.OSGiRetailerImpl diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf new file mode 100644 index 0000000000..de7ac7ec7a --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Shipper +Bundle-SymbolicName: supplychain.shipper.Shipper +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + supplychain.customer +Export-Package: supplychain.shipper +Bundle-Activator: supplychain.shipper.OSGiShipperImpl diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf new file mode 100644 index 0000000000..21241a6899 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Warehouse +Bundle-SymbolicName: supplychain.warehouse.Warehouse +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + supplychain.shipper +Export-Package: supplychain.warehouse +Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf new file mode 100644 index 0000000000..b5c5a862be --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Customer +Bundle-SymbolicName: ds.supplychain.customer.Customer +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + org.osgi.service.component, supplychain.retailer +Export-Package: supplychain.customer +Service-Component: osgi/ds/Customer.xml diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml new file mode 100644 index 0000000000..5b368afd5b --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf new file mode 100644 index 0000000000..47897d16ca --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Retailer +Bundle-SymbolicName: ds.supplychain.retailer.Retailer +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + org.osgi.service.component, + supplychain.warehouse +Export-Package: supplychain.retailer +Service-Component: osgi/ds/Retailer.xml diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml new file mode 100644 index 0000000000..cae7fdfde2 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf new file mode 100644 index 0000000000..f5333c7caa --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf @@ -0,0 +1,10 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Shipper +Bundle-SymbolicName: ds.supplychain.shipper.Shipper +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + org.osgi.service.component, supplychain.customer +Export-Package: supplychain.shipper +Service-Component: osgi/ds/Shipper.xml diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml new file mode 100644 index 0000000000..d894309b71 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml @@ -0,0 +1,33 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf new file mode 100644 index 0000000000..6166549e5a --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Warehouse +Bundle-SymbolicName: ds.supplychain.warehouse.Warehouse +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Import-Package: org.osgi.framework, + org.osgi.service.component, + supplychain.shipper +Export-Package: supplychain.warehouse +Service-Component: osgi/ds/Warehouse.xml diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml new file mode 100644 index 0000000000..fc86a76784 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.composite b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.composite new file mode 100644 index 0000000000..0bbfed9176 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite new file mode 100644 index 0000000000..d1e11168e2 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/java/sca/contrib/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java new file mode 100644 index 0000000000..ff15c0d9a2 --- /dev/null +++ b/java/sca/contrib/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + + +import supplychain.customer.Customer; + +/** + * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component and + * invoke it. + */ +public class SupplyChainClientTestCase extends TestCase { + + private SCADomain scaDomain; + private Customer customer; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("supplychain.composite"); + customer = scaDomain.getService(Customer.class, "CustomerComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + + public void test() throws Exception { + + customer.purchaseGoods(); + + System.out.println("Sleeping ..."); + Thread.sleep(2000); + System.out.println("Test complete"); + + } + + +} diff --git a/java/sca/contrib/samples/photo-gallery/README b/java/sca/contrib/samples/photo-gallery/README new file mode 100644 index 0000000000..c66edea985 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/README @@ -0,0 +1,28 @@ +Photo-Gallery Sample +====================================== + +This is a sample store scenario that is used as a getting started guide +for Tuscany SCA. For detailed information, please see: + +http://tuscany.apache.org/getting-started-with-tuscany.html + +or + +http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as follows: + +cd store +ant compile + +and then, to run: + +ant run + +Once the store application is running use your browser to visit the following +URL: + +http://localhost:8080/gallery/ diff --git a/java/sca/contrib/samples/photo-gallery/build.xml b/java/sca/contrib/samples/photo-gallery/build.xml new file mode 100644 index 0000000000..652afc3570 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/build.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/photo-gallery/photo-gallery.png b/java/sca/contrib/samples/photo-gallery/photo-gallery.png new file mode 100644 index 0000000000..da413edeee Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/photo-gallery.png differ diff --git a/java/sca/contrib/samples/photo-gallery/photo-gallery.svg b/java/sca/contrib/samples/photo-gallery/photo-gallery.svg new file mode 100644 index 0000000000..74f8ecd36d --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/photo-gallery.svg @@ -0,0 +1,304 @@ + + + + + + + + + + image/svg+xml + + + + + + + + store + ufs + + ShoppingCart + + CurrencyConverter + + + + + + + + + + CurrenyCode HTTP JSONRPC Atom + + Catalog + + + + diff --git a/java/sca/contrib/samples/photo-gallery/pom.xml b/java/sca/contrib/samples/photo-gallery/pom.xml new file mode 100644 index 0000000000..b96a89f0fc --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/pom.xml @@ -0,0 +1,148 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../pom.xml + + sample-photo-gallery + Apache Tuscany SCA Getting Started Online Store Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-widget-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + org.apache.derby + derby + 10.2.1.6 + + + + org.slf4j + slf4j-api + 1.3.0 + + + + org.slf4j + slf4j-log4j12 + 1.3.0 + + + + org.slf4j + jcl104-over-slf4j + 1.3.0 + + + + javax.jcr + jcr + 1.0 + + + + org.apache.jackrabbit + jackrabbit-core + 1.4 + + + + org.apache.jackrabbit + jackrabbit-api + 1.4 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGallery.java b/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGallery.java new file mode 100644 index 0000000000..1007cd49b0 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGallery.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LaunchGallery { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("photo-gallery.composite"); + System.out.println("photo.gallery.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java b/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java new file mode 100644 index 0000000000..d07dc63592 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class LaunchGalleryJCR { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("photo-gallery-jcr.composite"); + System.out.println("photo.gallery.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/contrib/samples/photo-gallery/src/main/java/services/Album.java b/java/sca/contrib/samples/photo-gallery/src/main/java/services/Album.java new file mode 100644 index 0000000000..d614b6a504 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/java/services/Album.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Album { + + public String[] getPictures(); + +} diff --git a/java/sca/contrib/samples/photo-gallery/src/main/java/services/AlbumImpl.java b/java/sca/contrib/samples/photo-gallery/src/main/java/services/AlbumImpl.java new file mode 100644 index 0000000000..3cdc56e641 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/java/services/AlbumImpl.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.io.File; +import java.io.FilenameFilter; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; + +public class AlbumImpl implements Album { + private String gallery; + private String album; + private String location; + private List pictures = new ArrayList(); + + @Property + public void setGallery(String gallery) { + this.gallery = gallery; + this.location = null; + } + @Property + public void setAlbum(String album) { + this.album = album; + this.location = null; + } + + protected String getLocation() { + if (location == null) { + location = gallery + "/" + album + "/"; + } + return location; + + } + + @Init + public void init() { + try { + URL albumURL = this.getClass().getClassLoader().getResource(getLocation()); + if(albumURL != null) { + File album = new File(albumURL.toURI()); + if (album.isDirectory() && album.exists()) { + String[] listPictures = album.list(new ImageFilter(".jpg")); + for(String image : listPictures) { + image = getLocation() + image; + pictures.add(image); + } + } + } + } catch (Exception e) { + // FIXME: ignore for now + e.printStackTrace(); + } + } + + public String[] getPictures() { + String[] pictureArray = new String[pictures.size()]; + pictures.toArray(pictureArray); + return pictureArray; + } + + /** + * Inner fileFilter class + */ + private class ImageFilter implements FilenameFilter { + String afn; + ImageFilter(String afn) { this.afn = afn; } + public boolean accept(File dir, String name) { + // Strip path information: + String f = new File(name).getName(); + return f.indexOf(afn) != -1; + } + } ///:~ + +} diff --git a/java/sca/contrib/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java b/java/sca/contrib/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java new file mode 100644 index 0000000000..8ede831ea0 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java @@ -0,0 +1,159 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services.jcr; + +import java.io.File; +import java.io.FilenameFilter; +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +import javax.jcr.Node; +import javax.jcr.NodeIterator; +import javax.jcr.Repository; +import javax.jcr.Session; +import javax.jcr.SimpleCredentials; + +import org.apache.jackrabbit.core.TransientRepository; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; + +import services.Album; + +public class AlbumImpl implements Album { + private String gallery; + private String album; + private String location; + private Repository repository=null; + private Session session=null; + + @Property + public void setGallery(String gallery) { + this.gallery = gallery; + this.location = null; + } + @Property + public void setAlbum(String album) { + this.album = album; + this.location = null; + } + + protected String getLocation() { + if (location == null) { + location = gallery + "/" + album + "/"; + } + return location; + + } + + @Init + public void init() { + try { + URL albumURL = this.getClass().getClassLoader().getResource(getLocation()); + if(albumURL != null) { + repository = new TransientRepository(); + session = repository.login( + new SimpleCredentials("username", "password".toCharArray())); + try { + File album = new File(albumURL.toURI()); + if (album.isDirectory() && album.exists()) { + String[] listPictures = album.list(new ImageFilter(".jpg")); + for(String image : listPictures) { + Node root=session.getRootNode(); + Node picNode=root.addNode(image); + InputStream inFile = getClass().getClassLoader().getResourceAsStream(getLocation()+image); + picNode.setProperty("image", inFile ); + picNode.setProperty("name", image); + picNode.setProperty("location", getLocation()+image); + //image = getLocation() + image; + //pictures.add(image); + } + } + + session.save(); + }catch (Exception e){ + // FIXME: ignore for now + e.printStackTrace(); + } + } + } catch (Exception e) { + // FIXME: ignore for now + e.printStackTrace(); + } + } + + public String[] getPictures() { + List pictures = new ArrayList(); + + try{ + Node root=session.getRootNode(); + NodeIterator nodes = root.getNodes(); + + while(nodes.hasNext()){ + Node node=nodes.nextNode(); + if(node.getPath().equals("/jcr:system")) continue; + + pictures.add(node.getProperty("location").getString()); + //System.out.println(node.getProperty("name").getString()); + //System.out.println(node.getPath()); + } + }catch (Exception e) { + // FIXME: ignore for now + e.printStackTrace(); + } + + String[] pictureArray = new String[pictures.size()]; + pictures.toArray(pictureArray); + removeNodes(); + return pictureArray; + } + + + public void removeNodes(){ + try{ + Node root=session.getRootNode(); + NodeIterator nodes = root.getNodes(); + while(nodes.hasNext()){ + Node node=nodes.nextNode(); + if(node.getPath().equals("/jcr:system")) continue; + else node.remove(); + } + session.save(); + }catch (Exception e) { + // FIXME: ignore for now + e.printStackTrace(); + } + + } + /** + * Inner fileFilter class + */ + private class ImageFilter implements FilenameFilter { + String afn; + ImageFilter(String afn) { this.afn = afn; } + public boolean accept(File dir, String name) { + // Strip path information: + String f = new File(name).getName(); + return f.indexOf(afn) != -1; + } + } ///:~ + +} diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery.html b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery.html new file mode 100644 index 0000000000..f6566e88ec --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery.html @@ -0,0 +1,135 @@ + + + +Photo Gallery + + + + + + + + + +
+

Apache Tuscany Photo Gallery

+
+
+ + +
+ + + + + +
+ + + + + + + + +
+
+ + + + + +
+ +
+ +
+ + + diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg new file mode 100644 index 0000000000..9437b321e2 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg new file mode 100644 index 0000000000..07f37ec505 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg new file mode 100644 index 0000000000..2193784271 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg new file mode 100644 index 0000000000..1532ee2c1b Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg new file mode 100644 index 0000000000..17ffd73aec Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg new file mode 100644 index 0000000000..19e9ec37df Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg new file mode 100644 index 0000000000..022416dbce Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg new file mode 100644 index 0000000000..c78a974714 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg new file mode 100644 index 0000000000..a98070925a Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg new file mode 100644 index 0000000000..dc83889116 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg new file mode 100644 index 0000000000..0e33548135 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/index.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/index.gif new file mode 100755 index 0000000000..7599ac7686 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/index.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/index_on.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/index_on.gif new file mode 100755 index 0000000000..153e9879d6 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/index_on.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/next.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/next.gif new file mode 100755 index 0000000000..002eaf6951 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/next.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/next_disabled.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/next_disabled.gif new file mode 100755 index 0000000000..38b1298453 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/next_disabled.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/next_on.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/next_on.gif new file mode 100755 index 0000000000..4e5bb3e7ef Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/next_on.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite b/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite new file mode 100644 index 0000000000..23190de555 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + gallery + boston + + + + + + + + + diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery.composite b/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery.composite new file mode 100644 index 0000000000..0bb3c4b4db --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/resources/photo-gallery.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + gallery + boston + + + + + + + + + diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/prev.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev.gif new file mode 100755 index 0000000000..4eea10f1dc Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_disabled.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_disabled.gif new file mode 100755 index 0000000000..7e35f07076 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_disabled.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_on.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_on.gif new file mode 100755 index 0000000000..3ef9a776bb Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/prev_on.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/show_slide.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/show_slide.gif new file mode 100644 index 0000000000..a5b6a15c2b Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/show_slide.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/space.gif b/java/sca/contrib/samples/photo-gallery/src/main/resources/space.gif new file mode 100644 index 0000000000..170fe82b65 Binary files /dev/null and b/java/sca/contrib/samples/photo-gallery/src/main/resources/space.gif differ diff --git a/java/sca/contrib/samples/photo-gallery/src/main/resources/styles.css b/java/sca/contrib/samples/photo-gallery/src/main/resources/styles.css new file mode 100755 index 0000000000..d23d949858 --- /dev/null +++ b/java/sca/contrib/samples/photo-gallery/src/main/resources/styles.css @@ -0,0 +1,121 @@ +body { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 12px; + color: #888888; + background-color: #000000; + margin-top: 0px; +} + +html { + scrollbar-face-color:#444444; + scrollbar-highlight-color:#000000; + scrollbar-3dlight-color:#000000; + scrollbar-darkshadow-color:#000000; + scrollbar-shadow-color:#000000; + scrollbar-arrow-color:#888888; + scrollbar-track-color:#000000; +} + +a:link { + text-decoration: none; + color: #AAAAAA; +} + +a:visited { + text-decoration: none; + color: #AAAAAA; +} + +a:hover { + text-decoration: none; + color: #FFFFFF; +} + +.current { + font-weight: bold; + color: #AAAAAA; + background-color: #666666; +} + +.cthumb { + background-color: #666666; + border: 0px; border-width: 0px; +} + +.thumb { + background-color: #333333; + border: 0px; border-width: 0px; +} + +.image { margin: 0px; border-width: 1px; border: 1px solid;} +a:link .image { border-color: #aaaaaa; color: #aaaaaa;} +a:visited .image { border-color: #666666; color: #666666;} +a:hover .image { border-color: #ffffff; color: #ffffff;} + +.slideImage { border-width: 0px; border: 0px solid; border-color: #ffffff;} +a:link .slideImage { border-color: #ffffff;} +a:visited .slideImage { border-color: #ffffff;} + +.title { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight: bold; + color: #000000; +} + +.title a:link { + text-decoration: none; + color: #000000; +} + +.title a:visited { + text-decoration: none; + color: #000000; +} + +.title a:hover { + text-decoration: none; + color: #ffffff; +} + +.infotable { + border: 1px solid #444444; + border-collapse: collapse; +} + +.infotable td { + border: 1px solid #444444; +} + +.infotable table td { + border: 0px; +} + +.dirname { + font-size: 12px; + font-weight: bold; + color: #AAAAAA; +} + +.comment { + color: #CCCCCC; + font-weight: bold; + font-size: 12px; +} + +.smalltxt { + color: #888888; + font-size: 11px; +} + +.xsmalltxt { + color: #888888; + font-size: 9px; +} + +.newlabel { + font-size: 8px; + font-weight: bold; + color: #EEEEEE; + background-color: #558800; +} \ No newline at end of file diff --git a/java/sca/contrib/samples/quote-xquery/README b/java/sca/contrib/samples/quote-xquery/README new file mode 100644 index 0000000000..cf8a4609a6 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/README @@ -0,0 +1,450 @@ +Quote Xquery Sample +=================== + + This sample covers the most important integration scenarios for the xquery + implementation type and its corresponding saxon data bindings. + +If you just want to run it to see what happens open two command prompts (one for the server +and the other for the client), navigate to this sample directory and do: + +Command Prompt 1: +ant +ant run-server + +Command Prompt 2: +ant run + +OR if you don't have ant, on Windows do + +In the directory samples\quote-xquery use the JDK 1.5 java command to run the class xquery.quote.XQueryQuoteClient + +Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteServer +Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteClient + +Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteServer +Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteClient + +Results +---------- +The sample when run should simply display on the standard output some startup messages followed by: + +The compilation: + +Buildfile: build.xml + +init: + +generate-sdo: + [java] >> Generating code + [java] >> Generating packages + [java] >> Generating package QuotePackageImpl + [java] >> Generating Java interface org.example.quote.QuoteFactory + [java] >> Generating /TargetProject/org/example/quote/QuoteFactory.java + [java] >> Examining old /TargetProject/org/example/quote/QuoteFactory.java + [java] >> Generating Java class org.example.quote.impl.QuoteFactoryImpl + [java] >> Generating /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java + [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java + [java] >> Generating Quote + [java] >> Generating Java interface org.example.quote.Quote + [java] >> Generating /TargetProject/org/example/quote/Quote.java + [java] >> Examining old /TargetProject/org/example/quote/Quote.java + [java] >> Generating Java class org.example.quote.impl.QuoteImpl + [java] >> Generating /TargetProject/org/example/quote/impl/QuoteImpl.java + [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteImpl.java + [java] >> Generating Response + [java] >> Generating Java interface org.example.quote.QuoteResponse + [java] >> Generating /TargetProject/org/example/quote/QuoteResponse.java + [java] >> Examining old /TargetProject/org/example/quote/QuoteResponse.java + [java] >> Generating Java class org.example.quote.impl.QuoteResponseImpl + [java] >> Generating /TargetProject/org/example/quote/impl/QuoteResponseImpl.java + [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteResponseImpl.java + [java] >> Generating code + [java] >> Generating packages + [java] >> Generating package AvailPackageImpl + [java] >> Generating Java interface org.example.avail.AvailFactory + [java] >> Generating /TargetProject/org/example/avail/AvailFactory.java + [java] >> Examining old /TargetProject/org/example/avail/AvailFactory.java + [java] >> Generating Java class org.example.avail.impl.AvailFactoryImpl + [java] >> Generating /TargetProject/org/example/avail/impl/AvailFactoryImpl.java + [java] >> Examining old /TargetProject/org/example/avail/impl/AvailFactoryImpl.java + [java] >> Generating Quote + [java] >> Generating Java interface org.example.avail.AvailQuote + [java] >> Generating /TargetProject/org/example/avail/AvailQuote.java + [java] >> Examining old /TargetProject/org/example/avail/AvailQuote.java + [java] >> Generating Java class org.example.avail.impl.AvailQuoteImpl + [java] >> Generating /TargetProject/org/example/avail/impl/AvailQuoteImpl.java + [java] >> Examining old /TargetProject/org/example/avail/impl/AvailQuoteImpl.java + [java] >> Generating Request + [java] >> Generating Java interface org.example.avail.AvailRequest + [java] >> Generating /TargetProject/org/example/avail/AvailRequest.java + [java] >> Examining old /TargetProject/org/example/avail/AvailRequest.java + [java] >> Generating Java class org.example.avail.impl.AvailRequestImpl + [java] >> Generating /TargetProject/org/example/avail/impl/AvailRequestImpl.java + [java] >> Examining old /TargetProject/org/example/avail/impl/AvailRequestImpl.java + [java] >> Generating code + [java] >> Generating packages + [java] >> Generating package PricePackageImpl + [java] >> Generating Java interface org.example.price.PriceFactory + [java] >> Generating /TargetProject/org/example/price/PriceFactory.java + [java] >> Examining old /TargetProject/org/example/price/PriceFactory.java + [java] >> Generating Java class org.example.price.impl.PriceFactoryImpl + [java] >> Generating /TargetProject/org/example/price/impl/PriceFactoryImpl.java + [java] >> Examining old /TargetProject/org/example/price/impl/PriceFactoryImpl.java + [java] >> Generating Quote + [java] >> Generating Java interface org.example.price.PriceQuote + [java] >> Generating /TargetProject/org/example/price/PriceQuote.java + [java] >> Examining old /TargetProject/org/example/price/PriceQuote.java + [java] >> Generating Java class org.example.price.impl.PriceQuoteImpl + [java] >> Generating /TargetProject/org/example/price/impl/PriceQuoteImpl.java + [java] >> Examining old /TargetProject/org/example/price/impl/PriceQuoteImpl.java + [java] >> Generating Request + [java] >> Generating Java interface org.example.price.PriceRequest + [java] >> Generating /TargetProject/org/example/price/PriceRequest.java + [java] >> Examining old /TargetProject/org/example/price/PriceRequest.java + [java] >> Generating Java class org.example.price.impl.PriceRequestImpl + [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestImpl.java + [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestImpl.java + [java] >> Generating Requests + [java] >> Generating Java interface org.example.price.PriceRequests + [java] >> Generating /TargetProject/org/example/price/PriceRequests.java + [java] >> Examining old /TargetProject/org/example/price/PriceRequests.java + [java] >> Generating Java class org.example.price.impl.PriceRequestsImpl + [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestsImpl.java + [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestsImpl.java + [java] >> Generating Ship Address + [java] >> Generating Java interface org.example.price.ShipAddress + [java] >> Generating /TargetProject/org/example/price/ShipAddress.java + [java] >> Examining old /TargetProject/org/example/price/ShipAddress.java + [java] >> Generating Java class org.example.price.impl.ShipAddressImpl + [java] >> Generating /TargetProject/org/example/price/impl/ShipAddressImpl.java + [java] >> Examining old /TargetProject/org/example/price/impl/ShipAddressImpl.java + +compile: + [jar] Building jar: C:\Apache\tuscany-sca-1.0-incubating-SNAPSHOT\samples\quote-xquery\target\sample-quote-xquery.jar +BUILD SUCCESSFUL + + +The service side: + +run-server: + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.core.StandardEngine start + [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.ContextConfig defaultWebConfig + [java] INFO: No default web.xml + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register + [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd + [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register + [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xsd + [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol init + [java] INFO: Initializing Coyote HTTP/1.1 on http-8085 + [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol start + [java] INFO: Starting Coyote HTTP/1.1 on http-8085 + [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8085/QuoteJoinService + [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping + [java] INFO: Added Servlet mapping: http://localhost:8085/AvailQuoteProviderService + [java] XQuery Quote server started (press enter to shutdown) + [java] Sep 18, 2007 1:16:54 PM org.apache.coyote.http11.Http11Protocol destroy + [java] INFO: Stopping Coyote HTTP/1.1 on http-8085 + +BUILD SUCCESSFUL +Total time: 2 minutes 51 seconds + +The client side: +Buildfile: build.xml + +run: + [java] Input quote for the price list: + [java] + [java] + [java] Acme Inc + [java] + [java] + [java] + [java] 12 + [java] 1.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] + [java] + [java] 211 + [java] 10.0 + [java] + [java] + [java] + [java] + [java] Input quote for the availability: + [java] + [java] + [java] + [java] 12 + [java] 10 + [java] true + [java] 2003-03-22 + [java] + [java] + [java] 134 + [java] 345 + [java] false + [java] BackOrder + [java] + [java] + [java] 211 + [java] 100 + [java] true + [java] 2003-04-21 + [java] + [java] + [java] + [java] + [java] Output quote from local join: + [java] + [java] + [java] Acme Inc + [java]
12 Springs Rd,Morris Plains,NJ,07960
+ [java] + [java] 12 + [java] 1.0 + [java] 10 + [java] true + [java] 2003-03-22 + [java] 0.1 + [java] 11.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] 345 + [java] false + [java] BackOrder + [java] 0.1 + [java] 0.0 + [java] + [java] + [java] 211 + [java] 10.0 + [java] 100 + [java] true + [java] 2003-04-21 + [java] 0.1 + [java] 1100.0 + [java] + [java]
+ [java] + [java] + [java] Output quote from local join (second invokation): + [java] + [java] + [java] Acme Inc + [java]
12 Springs Rd,Morris Plains,NJ,07960
+ [java] + [java] 12 + [java] 1.0 + [java] 10 + [java] true + [java] 2003-03-22 + [java] 0.2 + [java] 12.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] 345 + [java] false + [java] BackOrder + [java] 0.2 + [java] 0.0 + [java] + [java] + [java] 211 + [java] 10.0 + [java] 100 + [java] true + [java] 2003-04-21 + [java] 0.2 + [java] 1200.0 + [java] + [java]
+ [java] + [java] + [java] Output quote from web service join: + [java] + [java] + [java] Acme Inc + [java]
12 Springs Rd,Morris Plains,NJ,07960
+ [java] + [java] 12 + [java] 1.0 + [java] 10 + [java] true + [java] 2003-03-22 + [java] 0.1 + [java] 11.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] 345 + [java] false + [java] BackOrder + [java] 0.1 + [java] 0.0 + [java] + [java] + [java] 211 + [java] 10.0 + [java] 100 + [java] true + [java] 2003-04-21 + [java] 0.1 + [java] 1100.0 + [java] + [java]
+ [java] + [java] + [java] Output quote from properties join: + [java] + [java] + [java] Acme Inc + [java]
12 Springs Rd,Morris Plains,NJ,07960
+ [java] + [java] 12 + [java] 1.0 + [java] 10 + [java] true + [java] 2003-03-22 + [java] 0.1 + [java] 11.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] 345 + [java] false + [java] BackOrder + [java] 0.1 + [java] 0.0 + [java] + [java] + [java] 211 + [java] 10.0 + [java] 100 + [java] true + [java] 2003-04-21 + [java] 0.1 + [java] 1100.0 + [java] + [java]
+ [java] + [java] + [java] Output quote from external references join: + [java] + [java] + [java] Acme Inc + [java]
12 Springs Rd,Morris Plains,NJ,07960
+ [java] + [java] 12 + [java] 1.0 + [java] 10 + [java] true + [java] 2003-03-22 + [java] 0.1 + [java] 11.0 + [java] + [java] + [java] 134 + [java] 34.1 + [java] 345 + [java] false + [java] BackOrder + [java] 0.1 + [java] 0.0 + [java] + [java] + [java] 211 + [java] 10.0 + [java] 100 + [java] true + [java] 2003-04-21 + [java] 0.1 + [java] 1100.0 + [java] + [java]
+ [java] + +BUILD SUCCESSFUL +Total time: 16 seconds + + + +Sample Overview +--------------- + + 1. There is a central component for invoking the different + scenarios: QuoteJoinLocalComponent + 2. It provides the following cases: + - invoke XQuery component in the current assembly, by providing all needed + information as input parameters + - invoke XQuery component in external assembly, which is exposed as a web + service + - invoke XQuery component in the current assembly, which retrieves the needed + information from the component properties + - invoke XQuery component in the current assembly, which retrieves the needed + information from its references to other components: + - one of the components is in the current assembly + - the other component is in anther assembly and it is exposed (and accessed) + as web service + + 3. All of the XQuery components have reference to a component for calculation of the + total price + 4. SDO is used for data interchange + +src/main/resources + wsdl + AvailQuote.xsd + PriceQuote.xsd + Quote.xsd + quotejoin.wsdl + META-INF + sca + quote_join_external_references.xq --- the external references xquery script + quote_join_properties.xq --- the property-based join xquery script + quote_join.xq --- the join xquery script + xqueryquotews.composite --- composite file for the client side + xqueryquotewsclient.composite --- composite file for the service side + + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +cd quote-xquery +ant compile +ant run-server + +you should see: +Buildfile: build.xml + +run: + + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd quote-xquery +mvn + + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/quote-xquery/build.xml b/java/sca/contrib/samples/quote-xquery/build.xml new file mode 100644 index 0000000000..a3a5acf102 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/build.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/pom.xml b/java/sca/contrib/samples/quote-xquery/pom.xml new file mode 100644 index 0000000000..2fa134132c --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/pom.xml @@ -0,0 +1,184 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-quote-xquery + Apache Tuscany SCA XQuery Quote Implementation Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-xquery + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sdo + tuscany-sdo-lib + 1.1.1 + + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.1.1 + + + + + + net.sf.saxon + saxon + 8.7 + + + + org.apache.tuscany.sca + tuscany-databinding-sdo + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + compile + + + + + + ${artifactId} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-source + generate-sources + + add-test-source + + + + target/sdo-source + + + + + + + org.apache.tuscany.sdo + tuscany-sdo-plugin + 1.1.1 + + + generate-quotejoin-sdo + generate-sources + + ${basedir}/src/main/resources/wsdl/quotejoin.wsdl + + + generate + + + + generate-quote-sdo + generate-sources + + ${basedir}/src/main/resources/wsdl/Quote.xsd + + + generate + + + + generate-avail-quote-sdo + generate-sources + + ${basedir}/src/main/resources/wsdl/AvailQuote.xsd + + + generate + + + + generate-price-quote-sdo + generate-sources + + ${basedir}/src/main/resources/wsdl/PriceQuote.xsd + + + generate + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java new file mode 100644 index 0000000000..81396b056a --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.avail.AvailQuote; +import org.oasisopen.sca.annotation.Service; + +@Service(AvailQuoteProviderService.class) +public class AvailQuoteProviderImpl implements AvailQuoteProviderService { + + public AvailQuote provideAvailQuote(String dummyString) { + return QuoteDataUtil.buildAvailQuoteData(); + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java new file mode 100644 index 0000000000..fb097c46f8 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import net.sf.saxon.om.NodeInfo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface AvailQuoteProviderNodeInfo { + NodeInfo provideAvailQuote(String dummyString); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java new file mode 100644 index 0000000000..c54febcd14 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.avail.AvailQuote; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface AvailQuoteProviderService { + AvailQuote provideAvailQuote(String dummyString); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java new file mode 100644 index 0000000000..ebe0cd51ae --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.quote.Quote; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface ExternalReferencesQuoteJoin { + public Quote joinPriceAndAvailQuotes(float taxRate); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java new file mode 100644 index 0000000000..92341ea26f --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.price.PriceQuote; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface PriceQuoteProvider { + + public PriceQuote providePriceQuote(); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java new file mode 100644 index 0000000000..d2d175430b --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.price.PriceQuote; + +public class PriceQuoteProviderImpl implements PriceQuoteProvider { + public PriceQuote providePriceQuote() { + return QuoteDataUtil.buildPriceQuoteData(); + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java new file mode 100644 index 0000000000..5669738c98 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import net.sf.saxon.om.NodeInfo; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface PriceQuoteProviderNodeInfo { + public NodeInfo providePriceQuote(); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java new file mode 100644 index 0000000000..1a71abab81 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +import org.example.quote.Quote; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface PropertiesQuoteJoin { + @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes") + @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse") + public Quote joinPriceAndAvailQuotes(); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java new file mode 100644 index 0000000000..5aea04bfb1 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface QuoteCalculator { + public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java new file mode 100644 index 0000000000..26331381a8 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +public class QuoteCalculatorImpl implements QuoteCalculator { + + public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder) { + float totalTax, costNoTax, totalCost; + if (fillOrder) { + // Calculate the total tax + totalTax = taxRate * quantity * price; + // Calculate the total cost without tax + costNoTax = quantity * price; + // Add the tax and the cost to get the total cost + totalCost = totalTax + costNoTax; + } else { + totalCost = 0; + } + return totalCost; + } + +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java new file mode 100644 index 0000000000..8ed02dc1ef --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import java.io.IOException; +import java.math.BigInteger; + + +import org.example.avail.AvailFactory; +import org.example.avail.AvailQuote; +import org.example.avail.AvailRequest; +import org.example.price.PriceFactory; +import org.example.price.PriceQuote; +import org.example.price.PriceRequest; +import org.example.price.PriceRequests; +import org.example.price.ShipAddress; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.XMLHelper; + +public class QuoteDataUtil { + + public static AvailQuote buildAvailQuoteData() { + AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote(); + AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest(); + availRequest.setWidgetId(BigInteger.valueOf(12)); + availRequest.setRequestedQuantity(10); + availRequest.setQuantityAvail(true); + availRequest.setShipDate("2003-03-22"); + availQuote.getAvailRequest().add(availRequest); + + availRequest = AvailFactory.INSTANCE.createAvailRequest(); + availRequest.setWidgetId(BigInteger.valueOf(134)); + availRequest.setRequestedQuantity(345); + availRequest.setQuantityAvail(false); + availRequest.setShipDate("BackOrder"); + availQuote.getAvailRequest().add(availRequest); + + availRequest = AvailFactory.INSTANCE.createAvailRequest(); + availRequest.setWidgetId(BigInteger.valueOf(211)); + availRequest.setRequestedQuantity(100); + availRequest.setQuantityAvail(true); + availRequest.setShipDate("2003-04-21"); + availQuote.getAvailRequest().add(availRequest); + + return availQuote; + } + + public static PriceQuote buildPriceQuoteData() { + PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote(); + priceQuote.setCustomerName("Acme Inc"); + + ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress(); + shipAddress.setStreet("12 Springs Rd"); + shipAddress.setCity("Morris Plains"); + shipAddress.setState("nj"); + shipAddress.setZip("07960"); + priceQuote.setShipAddress(shipAddress); + + PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests(); + PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest(); + priceRequest.setWidgetId(BigInteger.valueOf(12)); + priceRequest.setPrice(1.00f); + priceRequests.getPriceRequest().add(priceRequest); + + priceRequest = PriceFactory.INSTANCE.createPriceRequest(); + priceRequest.setWidgetId(BigInteger.valueOf(134)); + priceRequest.setPrice(34.10f); + priceRequests.getPriceRequest().add(priceRequest); + + priceRequest = PriceFactory.INSTANCE.createPriceRequest(); + priceRequest.setWidgetId(BigInteger.valueOf(211)); + priceRequest.setPrice(10.00f); + priceRequests.getPriceRequest().add(priceRequest); + + priceQuote.setPriceRequests(priceRequests); + + return priceQuote; + } + + public static void serializeToSystemOut(DataObject object, String name) { + XMLHelper helper = XMLHelper.INSTANCE; + + try { + helper.save(object, null, name, System.out); + System.out.println(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java new file mode 100644 index 0000000000..103d19e59d --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + +import org.example.avail.AvailQuote; +import org.example.price.PriceQuote; +import org.example.quote.Quote; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface QuoteJoin { + @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes") + @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse") + public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java new file mode 100644 index 0000000000..cfd201f883 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.avail.AvailQuote; +import org.example.price.PriceQuote; +import org.example.quote.Quote; + +public interface QuoteJoinLocal { + public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); + + public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); + + public Quote joinPriceAndAvailQuotes(); + + public Quote joinPriceAndAvailQuotes(float taxRate); + +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java new file mode 100644 index 0000000000..26bcfe9707 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.example.avail.AvailQuote; +import org.example.price.PriceQuote; +import org.example.quote.Quote; +import org.oasisopen.sca.annotation.Reference; + +public class QuoteJoinLocalImpl implements QuoteJoinLocal { + private QuoteJoin quoteJoin; + private QuoteJoin quoteJoinWs; + private PropertiesQuoteJoin propertiesQuoteJoin; + private ExternalReferencesQuoteJoin externalServicesQuoteJoin; + + @Reference + public void setQuoteJoin(QuoteJoin quoteJoin) { + this.quoteJoin = quoteJoin; + } + + @Reference + public void setQuoteJoinWs(QuoteJoin quoteJoinWs) { + this.quoteJoinWs = quoteJoinWs; + } + + @Reference + public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) { + this.propertiesQuoteJoin = propertiesQuoteJoin; + } + + @Reference + public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) { + this.externalServicesQuoteJoin = externalServicesQuoteJoin; + } + + public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { + return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); + } + + public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { + return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); + } + + public Quote joinPriceAndAvailQuotes(float taxRate) { + return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate); + } + + public Quote joinPriceAndAvailQuotes() { + return propertiesQuoteJoin.joinPriceAndAvailQuotes(); + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java new file mode 100644 index 0000000000..adc852acd4 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.example.avail.AvailQuote; +import org.example.price.PriceQuote; +import org.example.quote.Quote; + +import commonj.sdo.DataObject; + +/** + * Integration test for the XQuery implementation type + * @version $Rev: 577067 $ $Date: 2007-09-18 22:10:03 +0100 (Tue, 18 Sep 2007) $ + * This test covers the most important integration scenarios for the xquery + * implementation type and its corresponding saxon data bindings: + * + * 1. There is a central component for invoking the different + * scenarios: QuoteJoinLocalComponent + * 2. It provides the following tests: + * - invoke XQuery component in the current assembly, by providing all needed + * information as input parameters + * - invoke XQuery component in external assembly, which is exposed as a web + * service + * - invoke XQuery component in the current assembly, which retrieves the needed + * information from the component properties + * - invoke XQuery component in the current assembly, which retrieves the needed + * information from its references to other components: + * - one of the components is in the current assembly + * - the other component is in anther assembly and it is exposed (and accessed) + * as web service + * + * 3. All of the XQuery components have reference to a component for calculation of the + * total price + * 4. SDO is used for data interchange + */ +public class XQueryQuoteClient { + + public static boolean SHOW_DEBUG_MSG = false; + + private SCADomain scaDomain; + + private QuoteJoinLocal quoteJoinLocal; + + public void startClient() throws Exception { + try { + scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite"); + quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent"); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + public void testQuoteJoin() { + AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData(); + PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData(); + + if (SHOW_DEBUG_MSG) { + System.out.println("Input quote for the price list:"); + QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote"); + System.out.println(); + System.out.println("Input quote for the availability:"); + QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote"); + System.out.println(); + } + + Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from local join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from local join (second invokation):"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.2f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from web service join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from properties join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from external references join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); + } + + public void stopClient() throws Exception { + if (scaDomain != null) { + scaDomain.close(); + } + } + + public static void main(String[] args) throws Exception { + SHOW_DEBUG_MSG = true; + XQueryQuoteClient client = new XQueryQuoteClient(); + client.startClient(); + try { + client.testQuoteJoin(); + } finally { + client.stopClient(); + } + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java new file mode 100644 index 0000000000..3fa3cdb637 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class XQueryQuoteServer { + + public static void main(String[] args) { + SCADomain scaDomain = SCADomain.newInstance("xqueryquotews.composite"); + try { + System.out.println("XQuery Quote server is started (press enter to shutdown)."); + System.in.read(); + System.out.println("XQuery Quote server is stopping..."); + } catch (IOException e) { + e.printStackTrace(); + } + scaDomain.close(); + System.out.println("XQuery Quote server is now stopped."); + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq new file mode 100644 index 0000000000..d504f40f04 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq @@ -0,0 +1,61 @@ +(: + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +:) + +declare namespace quoteJoin="scaservice:java/xquery.quote.QuoteJoin"; + +declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; + +declare namespace quo="http://www.example.org/quote"; + +declare variable $quoteCalculator external; + +declare function quoteJoin:joinPriceAndAvailQuotes($priceQuoteDoc, $availQuoteDoc, $taxRate) { + + { data($priceQuoteDoc/*/customerName) } + { concat($priceQuoteDoc/*/shipAddress/@street , ",", $priceQuoteDoc/*/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/*/shipAddress/@state) , ",", $priceQuoteDoc/*/shipAddress/@zip) } + { + for $priceRequest in $priceQuoteDoc/*/priceRequests/priceRequest, + $availRequest in $availQuoteDoc/*/availRequest + where data($priceRequest/widgetId) = data($availRequest/widgetId) + return + + { data($priceRequest/widgetId) } + { data($priceRequest/price) } + { data($availRequest/requestedQuantity) } + { data($availRequest/quantityAvail) } + { + for $shipDate in $availRequest/shipDate + return + { data($shipDate) } + } + { $taxRate } + { quoteCalculator:calculateTotalPrice( + $quoteCalculator, + + xs:float($taxRate), + + $availRequest/requestedQuantity, + + $priceRequest/price, + + $availRequest/quantityAvail) } + + } + +}; diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq new file mode 100644 index 0000000000..cc50da164a --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq @@ -0,0 +1,69 @@ +(: + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +:) +declare namespace quoteJoin="scaservice:java/xquery.quote.ExternalReferencesQuoteJoin"; + +declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; + +declare namespace priceQuoteProvider="scareference:java/xquery.quote.PriceQuoteProviderNodeInfo"; +declare namespace availQuoteProvider="scareference:java/xquery.quote.AvailQuoteProviderNodeInfo"; + +declare namespace quo="http://www.example.org/quote"; + +declare variable $quoteCalculator external; + +declare variable $priceQuoteProvider external; +declare variable $availQuoteProvider external; + +declare function quoteJoin:joinPriceAndAvailQuotes($taxRate) { +let $priceQuoteDoc := priceQuoteProvider:providePriceQuote($priceQuoteProvider) +let $availQuoteDoc := availQuoteProvider:provideAvailQuote($availQuoteProvider, 'dummy') +return + + { data($priceQuoteDoc/priceQuote/customerName) } + { concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) } + { + for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest, + $availRequest in $availQuoteDoc/availQuote/availRequest + where data($priceRequest/widgetId) = data($availRequest/widgetId) + return + + { data($priceRequest/widgetId) } + { data($priceRequest/price) } + { data($availRequest/requestedQuantity) } + { data($availRequest/quantityAvail) } + { + for $shipDate in $availRequest/shipDate + return + { data($shipDate) } + } + { $taxRate } + { quoteCalculator:calculateTotalPrice( + $quoteCalculator, + + $taxRate, + + $availRequest/requestedQuantity, + + $priceRequest/price, + + $availRequest/quantityAvail) } + + } + +}; diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq new file mode 100644 index 0000000000..cf41ab528d --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq @@ -0,0 +1,74 @@ +(: + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +:) + +declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin"; + +declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; + +declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote"; +declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote"; +declare namespace taxRate="scaproperty:java/java.lang.Float"; + +declare namespace pri="http://www.example.org/price"; +declare namespace ava="http://www.example.org/avail"; +declare namespace quo="http://www.example.org/quote"; + +declare variable $quoteCalculator external; + +declare variable $priceQuoteDoc external; +declare variable $availQuoteDoc external; +declare variable $taxRate external; + +declare function quoteJoin:joinPriceAndAvailQuotes() { + + { data($priceQuoteDoc/pri:priceQuote/customerName) } + { concat($priceQuoteDoc/pri:priceQuote/shipAddress/@street , ",", + $priceQuoteDoc/pri:priceQuote/shipAddress/@city ,",", + fn:upper-case($priceQuoteDoc/pri:priceQuote/shipAddress/@state) , ",", + $priceQuoteDoc/pri:priceQuote/shipAddress/@zip) } + { + for $priceRequest in $priceQuoteDoc/pri:priceQuote/priceRequests/priceRequest, + $availRequest in $availQuoteDoc/ava:availQuote/availRequest + where data($priceRequest/widgetId) = data($availRequest/widgetId) + return + + { data($priceRequest/widgetId) } + { data($priceRequest/price) } + { data($availRequest/requestedQuantity) } + { data($availRequest/quantityAvail) } + { + for $shipDate in $availRequest/shipDate + return + { data($shipDate) } + } + { $taxRate } + { quoteCalculator:calculateTotalPrice( + $quoteCalculator, + + $taxRate, + + $availRequest/requestedQuantity, + + $priceRequest/price, + + $availRequest/quantityAvail) } + + } + +}; diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd new file mode 100644 index 0000000000..e7f3e67068 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd new file mode 100644 index 0000000000..4c437586ef --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd new file mode 100644 index 0000000000..4f64850056 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl new file mode 100644 index 0000000000..96c2af138a --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotews.composite b/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotews.composite new file mode 100644 index 0000000000..9e35e2ecb2 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotews.composite @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite new file mode 100644 index 0000000000..35306b9f89 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + Acme Inc + + + + 12 + 1.0 + + + 134 + 34.1 + + + 211 + 10.0 + + + + + + + + + + 12 + 10 + true + 2003-03-22 + + + 134 + 345 + false + BackOrder + + + 211 + 100 + true + 2003-04-21 + + + + 0.1 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java new file mode 100644 index 0000000000..9555532b3e --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java @@ -0,0 +1,192 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import java.util.List; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; +import org.example.avail.AvailQuote; +import org.example.avail.AvailRequest; +import org.example.price.PriceQuote; +import org.example.price.PriceRequest; +import org.example.price.ShipAddress; +import org.example.quote.Quote; +import org.example.quote.QuoteResponse; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import commonj.sdo.DataObject; + +/** + * Integration test for the XQuery implementation type + * @version $Rev$ $Date$ + * This test covers the most important integration scenarios for the xquery + * implementation type and its corresponding saxon data bindings: + * + * 1. There is a central component for invoking the different + * scenarios: QuoteJoinLocalComponent + * 2. It provides the following tests: + * - invoke XQuery component in the current assembly, by providing all needed + * information as input parameters + * - invoke XQuery component in external assembly, which is exposed as a web + * service + * - invoke XQuery component in the current assembly, which retrieves the needed + * information from the component properties + * - invoke XQuery component in the current assembly, which retrieves the needed + * information from its references to other components: + * - one of the components is in the current assembly + * - the other component is in anther assembly and it is exposed (and accessed) + * as web service + * + * 3. All of the XQuery components have reference to a component for calculation of the + * total price + * 4. SDO is used for data interchange + */ +public class XQueryQuoteClientTestCase { + + public static boolean SHOW_DEBUG_MSG = false; + + private SCADomain scaDomain; + private SCATestCaseRunner server; + + private QuoteJoinLocal quoteJoinLocal; + + @Before + public void startClient() throws Exception { + try { + scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite"); + + quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent"); + + server = new SCATestCaseRunner(XQueryQuoteTestServer.class); + server.before(); + } catch (Throwable t) { + t.printStackTrace(); + } + } + + @Test + public void testQuoteJoin() { + AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData(); + PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData(); + + if (SHOW_DEBUG_MSG) { + System.out.println("Input quote for the price list:"); + QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote"); + System.out.println(); + System.out.println("Input quote for the availability:"); + QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote"); + System.out.println(); + } + + Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from local join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from local join (second invokation):"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.2f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from web service join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from properties join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); + + quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f); + if (SHOW_DEBUG_MSG) { + System.out.println(); + System.out.println("Output quote from external references join:"); + QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); + System.out.println(); + } + XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); + } + + @After + public void stopClient() throws Exception { + server.after(); + scaDomain.close(); + } + + public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) { + QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl(); + + TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName()); + ShipAddress shipAddress = priceQuote.getShipAddress(); + TestCase.assertEquals(shipAddress.getStreet() + "," + + shipAddress.getCity() + + "," + + shipAddress.getState().toUpperCase() + + "," + + shipAddress.getZip(), quote.getAddress()); + List availRequests = availQuote.getAvailRequest(); + List priceRequests = priceQuote.getPriceRequests().getPriceRequest(); + List quoteResponses = quote.getQuoteResponse(); + TestCase.assertEquals(availRequests.size(), priceRequests.size()); + TestCase.assertEquals(availRequests.size(), quoteResponses.size()); + + for (int i = 0; i < availRequests.size(); i++) { + AvailRequest availRequest = (AvailRequest)availRequests.get(i); + PriceRequest priceRequest = (PriceRequest)priceRequests.get(i); + QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i); + TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId()); + TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice()); + TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity()); + TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder()); + if (availRequest.getShipDate() == null) { + TestCase.assertNull(quoteResponse.getShipDate()); + } else { + TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate()); + } + TestCase.assertEquals(taxRate, quoteResponse.getTaxRate()); + TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate, + availRequest.getRequestedQuantity(), + priceRequest.getPrice(), + availRequest.isQuantityAvail()), + quoteResponse.getTotalCost()); + } + } +} diff --git a/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java b/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java new file mode 100644 index 0000000000..9a4be5bda6 --- /dev/null +++ b/java/sca/contrib/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package xquery.quote; + +import java.io.IOException; +import java.net.Socket; + +import org.apache.tuscany.sca.host.embedded.SCADomain; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class XQueryQuoteTestServer { + private SCADomain scaDomain; + + @Before + public void startServer() throws Exception { + try { + scaDomain = SCADomain.newInstance("xqueryquotews.composite"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Test + public void testPing() throws IOException { + new Socket("127.0.0.1", 8085); + } + + @After + public void stopServer() throws Exception { + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/README b/java/sca/contrib/samples/simple-bigbank-spring/README new file mode 100644 index 0000000000..bb44d63719 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/README @@ -0,0 +1,148 @@ +Spring Bigbank Sample +====================== +This sample is made of 3 modules that represent the different aspects of a fictitious banking application. + +To run the simple-bigbank-spring sample you need to first run spring-bigbank-calculator, spring-bigbank-checkaccount and spring-bigbank-stockquote composites. +This will bring up Tuscany runtime and load the three applications and make them available as services. +Bigbank-Spring is dependent on these services. + +This demo uses ant. This is just one way of running this demo. + +Start Spring-Bigbank-calculator Composite +----------------------------------------- + +Spring-Bigbank-calculator is a calculator application which handles add, subtract, multiply and divide operations. Each of these operations is implemented in a different language, including JavaScript, groovy, Ruby and Python. + +To run the spring-bigbank-calculator composite and make it available as a service for this demo do the following: + +cd spring-bigbank-calculator +ant compile +ant run + +.. Leave the server running + +Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on. + +Start Spring-Bigbank-checkaccount Composite +------------------------------------------- + +This contains all artifacts that deal with the account management within the bigbank. The services offered by the bigbank-account module are used by the bigbank. + +cd spring-bigbank-checkaccount +ant compile +ant run + +.. Leave the server running + +Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on. + +Start Spring-Bigbank-stockquote Composite +----------------------------------------- + +A very simple web services based stock quote application which returns random +stock quotes on request. Please note that the stockquote service is not live and is implemented instead to allow for this application to always run without dependency on the availability of a webservice. + +cd spring-bigbank-stockquote +ant compile +ant run + +.. Leave the server running + +Start Spring Bigbank +-------------------- +This contains all artifacts that make up the bigbank application. This is the application that the end user interacts with + +Start spring-bigbank in the following way: + +i ) Compile the spring-bigbank as follows : + + cd simple-bigbank-spring + ant compile + +ii) Now start the bigbank service as follows : + + cd bigbank + ant compile + ant run + + .. Leave the server running + +Note that 'ant compile' needs to be done the first time you run this demo out ofthe binary distribution. +No need to do 'ant compile' from there on. + +Sample Overview +--------------- +This sample demonstrates a simple bank summary transaction using Spring for one of the components. + +A request to the AccountComponent results in a request to the AccountDataComponent to get account data +which is based on a random stock quote price. Therefore result for this sample will vary on each run. + + +simple-bigbank-spring/ + src/ + main/ + java/ + bigbank/ + account/ - AccountComponent implementation using Spring + accountdata/ - AccountDataComponent implementation using Spring + sockquote/ - stockquote implementation using Java + client/ - starts the SCA Runtime and + deploys the BigBank.composite. + It then calls the deployed AccountService + resources/ + Account.composite - SCA assembly for this sample + BigBank.composite - SCA assembly for this sample + StockQuote.composite - SCA assembly for this sample + test/ + java/ + bigbank/ + BigBankTestCase.java - JUnit test case + simple-bigbank-spring.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd simple-bigbank-spring +ant compile +ant run + +You should see the following output. +** Please note that balance amount will vary depending on the random stock value. + +run: + [java] Spring parent context - getBean called for name: stockQuoteService + [java] Getting stock quote for: IBM, value: 104.97 + [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID +:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10497.0] + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd simple-bigbank-spring +mvn + +You should see the following output from the test phase. +** Please note that balance amount will vary depending on the random stock value. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running bigbank.BigBankTestCase +Getting stock quote for: IBM, value: 104.02 +Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234 +5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0] +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/simple-bigbank-spring/build-dojo.xml b/java/sca/contrib/samples/simple-bigbank-spring/build-dojo.xml new file mode 100644 index 0000000000..9d282c2dd2 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/build.xml b/java/sca/contrib/samples/simple-bigbank-spring/build.xml new file mode 100644 index 0000000000..ecc2596d71 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/pom.xml b/java/sca/contrib/samples/simple-bigbank-spring/pom.xml new file mode 100644 index 0000000000..5e71de9a6b --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/pom.xml @@ -0,0 +1,277 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-simple-bigbank-spring + Apache Tuscany SCA Spring-Based Simplified BigBank Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-SNAPSHOT + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + commons-httpclient + commons-httpclient + 3.0.1 + + + + commons-logging + commons-logging + 1.1 + + + javax.servlet + servlet-api + + + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rss-rome + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + sample-spring-bigbank-checkaccount + 2.0-SNAPSHOT + test + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + org.springframework + spring-core + 2.5.5 + + + + org.springframework + spring-beans + 2.5.5 + + + + org.springframework + spring-context + 2.5.5 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.png b/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.png new file mode 100644 index 0000000000..593c047f6a Binary files /dev/null and b/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.png differ diff --git a/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.svg b/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.svg new file mode 100644 index 0000000000..c64f6de6b9 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/simple-bigbank-spring.svg @@ -0,0 +1,200 @@ + + + + + + + + + + image/svg+xml + + + + + + + + BigBank + + AccountServiceComponent + + + + + AccountDataServiceComponent + + + currency AccountService + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java new file mode 100644 index 0000000000..1625ff5b65 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import java.util.List; + +/** + */ +public class AccountReport { + private List summaries; + private String currency; + + public AccountReport(String currency, List summaries) { + this.currency = currency; + this.summaries = summaries; + } + + public List getAccountSummaries() { return summaries; } + + public String getCurrency() { return currency; } + + @Override + public String toString() { + return "currency: "+ currency + ", " + summaries; + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java new file mode 100644 index 0000000000..7c9082b944 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +/** + * Interface for a account service + */ +public interface AccountService { + public AccountReport getAccountReport(String customerID); +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java new file mode 100644 index 0000000000..6252697ffe --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import java.util.ArrayList; +import java.util.List; + +import org.oasisopen.sca.annotation.Service; + +import bigbank.account.checking.CheckingAccountDetails; +import bigbank.account.checking.CheckingAccountService; +import bigbank.account.savings.SavingsAccountDetails; +import bigbank.account.savings.SavingsAccountService; +import bigbank.account.stock.StockAccountDetails; +import bigbank.account.stock.StockAccountService; +import bigbank.stockquote.StockQuoteService; +import bigbank.calculator.CalculatorService; + +/** + * Account service implementation + */ +@Service(AccountService.class) +public class AccountServiceImpl implements AccountService { + + private SavingsAccountService savingsAccountService; + + private CheckingAccountService checkingAccountService; + + private StockAccountService stockAccountService; + + private CalculatorService calculatorService; + + private StockQuoteService stockQuoteService; + + private String currency; + + public AccountReport getAccountReport(String customerID) { + + // Get the checking, savings and stock accounts from the AccountData + // service component + CheckingAccountDetails checking = null; + List summaries = new ArrayList(); + try { + checking = checkingAccountService.getAccountDetails(customerID); + System.out.println("Checking account: " + checking); + summaries.add(checking.toString()); + + SavingsAccountDetails savings = savingsAccountService.getAccountDetails(customerID); + System.out.println("Savings account: " + savings); + summaries.add(savings.toString()); + + StockAccountDetails stock = stockAccountService.getAccountDetails(customerID); + System.out.println("Stock account: " + stock); + summaries.add(stock.toString()); + + // Get the stock price in USD + double price = stockQuoteService.getQuote(stock.getSymbol()); + System.out.println("Stock price for " + stock.getSymbol() + ": " + price); + + // Convert to the configured currency + if (currency.equals("EURO")) { + + // Use our fancy calculator service to convert to the target currency + price = calculatorService.multiply(price, 0.70); + + System.out.println("Converted to " + currency + ": " + price); + } + + // Calculate the value of the stock account + double stockValue = price * stock.getQuantity(); + summaries.add(stock.toString()); + + AccountReport report = new AccountReport(currency, summaries); + + return report; + } catch ( Throwable e ) { + e.printStackTrace(); + return null; + } + } + + public SavingsAccountService getSavingsAccountService() { + return savingsAccountService; + } + + public void setSavingsAccountService(SavingsAccountService savingsAccountService) { + this.savingsAccountService = savingsAccountService; + } + + public CheckingAccountService getCheckingAccountService() { + return checkingAccountService; + } + + public void setCheckingAccountService(CheckingAccountService checkingAccountService) { + this.checkingAccountService = checkingAccountService; + } + + public StockAccountService getStockAccountService() { + return stockAccountService; + } + + public void setStockAccountService(StockAccountService stockAccountService) { + this.stockAccountService = stockAccountService; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public CalculatorService getCalculatorService() { + return calculatorService; + } + + public void setCalculatorService(CalculatorService calculatorService) { + this.calculatorService = calculatorService; + } + + public StockQuoteService getStockQuoteService() { + return stockQuoteService; + } + + public void setStockQuoteService(StockQuoteService stockQuoteService) { + this.stockQuoteService = stockQuoteService; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java new file mode 100644 index 0000000000..3f81f48fb9 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +public class CheckingAccountDetails { + private String accountNumber; + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double b) { + this.balance = b; + } + + @Override + public String toString() { + return accountNumber + ", balance:" + balance; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java new file mode 100644 index 0000000000..8596181d7f --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import org.oasisopen.sca.annotation.Remotable; +import org.oasisopen.sca.annotation.Service; + +@Service +@Remotable +public interface CheckingAccountService { + + public CheckingAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java new file mode 100644 index 0000000000..2b086ec467 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.feed; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +import bigbank.account.AccountService; +import bigbank.account.AccountReport; + +/** + * @version $$Rev$$ $$Date$$ + */ + +@Service(Collection.class) +public class AccountFeedImpl implements Collection { + + @Reference + protected AccountService accountService; + + public Entry[] getAll() { + + // Add the Account report entry + String report = get("1234"); + Entry entry = new Entry("1234", report); + + return new Entry[] { entry } ; + } + + public String get(String id) { + + // Get the account report for the specified customer ID + AccountReport accreport = accountService.getAccountReport(id); + String report = accreport.getCurrency(); + + return report; + } + + public void delete(String key) throws NotFoundException { + } + + public String post(String key, String item) { + return null; + } + + public void put(String key, String item) throws NotFoundException { + } + + public Entry[] query(String queryString) { + return null; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java new file mode 100644 index 0000000000..bcac678cd7 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import java.io.Serializable; + +public class SavingsAccountDetails implements Serializable { + private String accountNumber; + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double b) { + this.balance = b; + } + + @Override + public String toString() { + return accountNumber + ", balance:" + balance; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java new file mode 100644 index 0000000000..070cfe12db --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface SavingsAccountService { + + public SavingsAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java new file mode 100644 index 0000000000..7682b729c3 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java @@ -0,0 +1,62 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.savings; + +import java.util.HashMap; +import java.util.Map; + +import org.oasisopen.sca.annotation.Service; + +@Service(SavingsAccountService.class) +public class SavingsAccountServiceImpl implements SavingsAccountService { + private Map custAcctMap = new HashMap(); + private Map savingsAccts = new HashMap(); + + public SavingsAccountServiceImpl() { + custAcctMap.put("Customer_01", "SVA_Customer_01"); + custAcctMap.put("Customer_02", "SVA_Customer_02"); + custAcctMap.put("Customer_03", "SVA_Customer_03"); + + savingsAccts.put("SVA_Customer_01", new Double(1000)); + savingsAccts.put("SVA_Customer_02", new Double(1500)); + savingsAccts.put("SVA_Customer_03", new Double(2000)); + } + + public double deposit(String accountNo, double depositAmt) { + savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt)); + return savingsAccts.get(accountNo).doubleValue(); + } + + public SavingsAccountDetails getAccountDetails(String customerID) { + SavingsAccountDetails savingsAccount = new SavingsAccountDetails(); + savingsAccount.setAccountNumber(custAcctMap.get(customerID)); + savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue()); + + return savingsAccount; + } + + public double withdraw(String accountNo, double withdrawalAmount) { + double balance = savingsAccts.get(accountNo).doubleValue(); + if ( balance - withdrawalAmount > 0 ) { + balance = balance - withdrawalAmount; + savingsAccts.put(accountNo, balance); + } + return balance; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java new file mode 100644 index 0000000000..9f06a71bae --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +public class StockAccountDetails { + private String accountNumber; + private String symbol; + private int quantity; + + public StockAccountDetails() { + } + + public StockAccountDetails(String acNo, String symbol, int qty) { + this.accountNumber = acNo; + this.symbol = symbol; + this.quantity = qty; + } + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public int getQuantity() { + return quantity; + } + + public void setQuantity(int a) { + this.quantity = a; + } + + public String getSymbol() { + return symbol; + } + + public void setSymbol(String s) { + this.symbol = s; + } + + @Override + public String toString() { + return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java new file mode 100644 index 0000000000..f86fda7c0f --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface StockAccountService { + + public StockAccountDetails getAccountDetails(String customerID); + + public StockAccountDetails buy(String accountNo, String symbol, int quantity); + + public StockAccountDetails sell(String accountNo, String symbol, int quantity); + + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java new file mode 100644 index 0000000000..488146ebeb --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.stock; + +import java.util.HashMap; +import java.util.Map; + +import org.oasisopen.sca.annotation.Service; + +@Service(StockAccountService.class) +public class StockAccountServiceImpl implements StockAccountService { + private Map custAcctMap = new HashMap(); + private Map stockAccts = new HashMap(); + + public StockAccountServiceImpl() { + custAcctMap.put("Customer_01", "STA_Customer_01"); + custAcctMap.put("Customer_02", "STA_Customer_02"); + custAcctMap.put("Customer_03", "STA_Customer_03"); + + stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100)); + stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200)); + stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125)); + } + + + public StockAccountDetails buy(String accountNo, String symbol, int quantity) { + return null; + } + + public StockAccountDetails getAccountDetails(String customerID) { + return stockAccts.get(custAcctMap.get(customerID)); + } + + public StockAccountDetails sell(String accountNo, String symbol, int quantity) { + return null; + } + + + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java new file mode 100644 index 0000000000..66a0ba0e63 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java new file mode 100644 index 0000000000..f7b940f873 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.client; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +import bigbank.account.AccountService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class BigBankClient { + public static void main(String[] args) throws Exception { + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankClient.class.getClassLoader()); + node.start(); + + AccountService accountService = ((SCAClient)node).getService(AccountService.class, "AccountServiceComponent"); + + System.out.println("Account summary: " + accountService.getAccountReport("Customer_01") ); + + node.stop(); + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java new file mode 100644 index 0000000000..241347e417 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.server; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class BigBankServer { + + public static void main(String[] args) throws Exception { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } + + System.out.println("Starting the Sample SCA Spring BigBank server..."); + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankServer.class.getClassLoader()); + node.start(); + + if (timeout < 0) { + System.out.println("Press Enter to Exit..."); + System.in.read(); + } else { + Thread.sleep(timeout); + } + + node.stop(); + + System.out.println("Bye"); + } +} diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..be86627882 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/BigBank.composite b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..ea2dbc7e1c --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/BigBank.composite @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite new file mode 100644 index 0000000000..4bb2ce61ef --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite new file mode 100644 index 0000000000..97dff499ba --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml new file mode 100644 index 0000000000..899d8d7d62 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml new file mode 100644 index 0000000000..b9e26bf81b --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..32fa070ffb --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF @@ -0,0 +1,4 @@ +Manifest-Version: 1.0 +Spring-Context: META-INF/spring/StockAccount-context.xml + + diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml new file mode 100644 index 0000000000..b30f821f7e --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml @@ -0,0 +1,33 @@ + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/web/style.css b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/web/style.css new file mode 100644 index 0000000000..1071583264 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/main/resources/web/style.css @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +* { font-family: arial; } + +table, th, td { border: 2px solid blue; border-collapse: collapse; } +th { color: white; background-color: blue; } diff --git a/java/sca/contrib/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java b/java/sca/contrib/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java new file mode 100644 index 0000000000..d82e383e46 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank; + +import junit.framework.TestCase; + +import bigbank.server.BigBankServer; + +/** + * Tests out the big bank service + * + */ +public class BigBankTestCase extends TestCase { + + public void testServer() throws Exception { + BigBankServer.main(new String[] {"1000"}); + } +} diff --git a/java/sca/contrib/samples/simple-bigbank/README b/java/sca/contrib/samples/simple-bigbank/README new file mode 100644 index 0000000000..acbe93a4d3 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/README @@ -0,0 +1,101 @@ +Calculator Sample +================= +This sample implements a simple a version of the BigBank scenrio used in +various places in the SCA specification documents. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank.jar bigbank.client.BigBankClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank.jar bigbank.client.BigBankClient + + +Sample Overview +--------------- +This sample demonstrates a simple bank summary transaction while using Java components wired together. +SCA default binding is used. + +A request to the AccountComponent results in a request to the AccountDataComponent to get account data +which is based on a random stock quote price. Therefore result for this sample will vary on each run. + +calculator/ + src/ + main/ + java/ + bigbank/ + account/ - AccountComponent implementation + accountdata/ - AccountDataComponent implementation + stockquote/ - generates random stock prices + client/ - starts the SCA Runtime and + deploys the BigBank.composite. + It then calls the deployed AccountService + resources/ + Account.composite - SCA assembly for this sample + BigBank.composite - SCA assembly for this sample + StockQuote.composite - SCA assembly for this sample + test/ + java/ + bigbank/ + BigBankTestCase.java - JUnit test case + simple-bigbank.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd simple-bigbank +ant compile +ant run + +You should see the following output from the run target. +** Please note that the balance amount is dependent on the random sotck quote price and the +numbers may vary on each run. + +run: + [java] Getting stock quote for: IBM, value: 104.06 + [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID +:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balanc +e:10406.0] + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd simple-bigbank +mvn + +You should see the following output from the test phase. +** Please note that the balance amount is dependent on the random sotck quote price and the numbers may vary on each run. + + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running bigbank.BigBankTestCase +Getting stock quote for: IBM, value: 104.02 +Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234 +5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0] +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/simple-bigbank/build.xml b/java/sca/contrib/samples/simple-bigbank/build.xml new file mode 100644 index 0000000000..a814014eae --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank/pom.xml b/java/sca/contrib/samples/simple-bigbank/pom.xml new file mode 100644 index 0000000000..82cbdfe4b6 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-simple-bigbank + Apache Tuscany SCA Simplified BigBank Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/simple-bigbank/simple-bigbank.png b/java/sca/contrib/samples/simple-bigbank/simple-bigbank.png new file mode 100644 index 0000000000..593c047f6a Binary files /dev/null and b/java/sca/contrib/samples/simple-bigbank/simple-bigbank.png differ diff --git a/java/sca/contrib/samples/simple-bigbank/simple-bigbank.svg b/java/sca/contrib/samples/simple-bigbank/simple-bigbank.svg new file mode 100644 index 0000000000..c64f6de6b9 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/simple-bigbank.svg @@ -0,0 +1,200 @@ + + + + + + + + + + image/svg+xml + + + + + + + + BigBank + + AccountServiceComponent + + + + + AccountDataServiceComponent + + + currency AccountService + diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java new file mode 100644 index 0000000000..1625ff5b65 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import java.util.List; + +/** + */ +public class AccountReport { + private List summaries; + private String currency; + + public AccountReport(String currency, List summaries) { + this.currency = currency; + this.summaries = summaries; + } + + public List getAccountSummaries() { return summaries; } + + public String getCurrency() { return currency; } + + @Override + public String toString() { + return "currency: "+ currency + ", " + summaries; + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java new file mode 100644 index 0000000000..7c9082b944 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +/** + * Interface for a account service + */ +public interface AccountService { + public AccountReport getAccountReport(String customerID); +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java new file mode 100644 index 0000000000..7a3c184cb2 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account; + +import java.util.ArrayList; +import java.util.List; + +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +import bigbank.accountdata.AccountDataService; +import bigbank.accountdata.CheckingAccount; +import bigbank.accountdata.SavingsAccount; +import bigbank.accountdata.StockAccount; +import bigbank.stockquote.StockQuoteService; + +/** + * Account service implementation + */ +public class AccountServiceImpl implements AccountService { + + @Reference + public AccountDataService accountDataService; + + @Reference + public StockQuoteService stockQuoteService; + + @Property + public String currency; + + public AccountReport getAccountReport(String s) { + List summaries = new ArrayList(); + + CheckingAccount ca = accountDataService.getCheckingAccount(s); + summaries.add(ca.getSummary()); + + SavingsAccount sa = accountDataService.getSavingsAccount(s); + summaries.add(sa.getSummary()); + + StockAccount sk = accountDataService.getStockAccount(s); + + double price = stockQuoteService.getQuote(sk.getSymbol()); + sk.setBalance(sk.getQuantity() * price); + + summaries.add(sk.getSummary()); + + AccountReport report = new AccountReport(currency, summaries); + + return report; + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java new file mode 100644 index 0000000000..a5ae7b3955 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * Interface for a account service + */ +public interface Account { + String getSummary(); +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java new file mode 100644 index 0000000000..c354de387b --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * Interface for a account data service + */ +public interface AccountDataService { + public CheckingAccount getCheckingAccount(String customerID); + public SavingsAccount getSavingsAccount(String customerID); + public StockAccount getStockAccount(String customerID); +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..000acb935c --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + + +/** + * Account data service implementation + */ +public class AccountDataServiceImpl implements AccountDataService { + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID+"_"+"CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID+"_"+"SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID+"_"+"STA12345"); + stockAccount.setSymbol("IBM"); + stockAccount.setQuantity(100); + + return stockAccount; + } +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..11bdff757e --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * An account service implementation for a checking account + */ +public class CheckingAccount implements Account { + private String accountNumber; + private double balance; + + public String getAccountNumber() { return accountNumber; } + public void setAccountNumber(String n) { this.accountNumber = n; } + + public double getBalance() { return balance; } + public void setBalance(double b) { this.balance = b; } + + public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..b791024076 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * An account service implementation for a savings account + */ +public class SavingsAccount implements Account { + private String accountNumber; + private double balance; + + public String getAccountNumber() { return accountNumber; } + public void setAccountNumber(String n) { this.accountNumber = n; } + + public double getBalance() { return balance; } + public void setBalance(double b) { this.balance = b; } + + public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java new file mode 100644 index 0000000000..86246a3f84 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.accountdata; + +/** + * An account service implementation for a stock account + */ +public class StockAccount implements Account { + private String accountNumber; + private String symbol; + private int quantity; + private double balance; + + public String getAccountNumber() { return accountNumber; } + public void setAccountNumber(String n) { this.accountNumber = n; } + + public double getQuantity() { return quantity; } + public void setQuantity(int a) { this.quantity = a; } + + public String getSymbol() { return symbol; } + public void setSymbol(String s) { this.symbol = s; } + + public double getBalance() { return balance; } + public void setBalance(double balance) { this.balance = balance; } + + public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity + ", balance:" + balance; } +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java new file mode 100644 index 0000000000..edbf910d37 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.client; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import bigbank.account.AccountService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class BigBankClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("BigBank.composite"); + + AccountService accountService = scaDomain.getService(AccountService.class, + "AccountServiceComponent"); + + System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); + + scaDomain.close(); + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java new file mode 100644 index 0000000000..0512d40b0b --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + + +/** + * This class implements the StockQuote service. + */ +public class StockQuoteImpl implements StockQuoteService { + + public double getQuote(String symbol) { + double price = 104.0 + Math.random(); + price = ((int)(price * 100)) / 100.0; + + System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); + + return price; + } + +} diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..4770c214ab --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + +import org.oasisopen.sca.annotation.Remotable; + + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} + diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/resources/Account.composite b/java/sca/contrib/samples/simple-bigbank/src/main/resources/Account.composite new file mode 100644 index 0000000000..e71615e27e --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/resources/Account.composite @@ -0,0 +1,38 @@ + + + + + + + + + + USD + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/resources/BigBank.composite b/java/sca/contrib/samples/simple-bigbank/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..c870f39cab --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/resources/BigBank.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank/src/main/resources/StockQuote.composite b/java/sca/contrib/samples/simple-bigbank/src/main/resources/StockQuote.composite new file mode 100644 index 0000000000..4f29c14851 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/main/resources/StockQuote.composite @@ -0,0 +1,31 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/java/sca/contrib/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java new file mode 100644 index 0000000000..ba6c1dd797 --- /dev/null +++ b/java/sca/contrib/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import bigbank.account.AccountService; + +/** + * Tests out the big bank service + * + */ +public class BigBankTestCase extends TestCase { + + private SCADomain scaDomain; + AccountService accountService; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("BigBank.composite"); + accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); + } +} diff --git a/java/sca/contrib/samples/simple-callback-ws/README b/java/sca/contrib/samples/simple-callback-ws/README new file mode 100644 index 0000000000..6b27718f74 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/README @@ -0,0 +1,144 @@ +Simple Callback Sample Using Web Services +========================================= +This sample demonstrates asynchronous messaging using a callback over the +Web Service binding. It is very similar to the simple-callback sample. +The only differences are that simplecallback.composite has been updated +to use the Web Service binding, and there is a simplecallback.wsdl file. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient + + +Sample Overview +--------------- +The sample provides a single composite with two components. MyClientComponent is +wired to MyServiceComponent. The interface of MyServiceComponent describes one +method as ONEWAY and with a callback semantic. When a message passes from +client to service the response is returned via the callback asynchronously. + +simple-callback/ + src/ + main/ + java/ + simplecallback/ + MyClient.java - client interface + MyClientImpl.java - implements the client and service callback + interfaces + MyService.java - service interface + MyServiceCallback.java - service callback interface, implemented by the + client + MyServiceImpl.java - implements the service interface + SimpleCallbackClient.java - starts the SCA Runtime and + deploys the simplecallback.composite. + It then calls MyClientComponent which in turn + calls MyServiceComponent + resources/ + simplecallback.composite - the SCA assembly for this sample + wsdl/ + simplecallback.wsdl - the service description and callback binding + test/ + java/ + simplecallback/ + SimpleCallbackTestCase.java - JUnit test case + simple-callback.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd simple-callback-ws +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackCo +mponent + [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent + [java] Main thread Thread[main,5,main] + [java] aClientMethod on thread Thread[main,5,main] + [java] aClientMethod return from someMethod on thread Thread[main,5,main] + [java] setMyServiceCallback on thread Thread[pool-1-thread-2,5,main] + [java] someMethod on thread Thread[pool-1-thread-2,5,main] + [java] receiveResult on thread Thread[pool-1-thread-4,5,main] + [java] Result: -> someMethod -> receiveResult + + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd simple-callback-ws +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running simplecallback.SimpleCallbackTestCase +14-Jan-2008 14:26:28 org.apache.catalina.core.StandardEngine start +INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 +14-Jan-2008 14:26:28 org.apache.catalina.startup.ContextConfig defaultWebConfig +INFO: No default web.xml +14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd +14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +1.dtd +14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ +2.dtd +14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ +0.xsd +14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register +WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs +d +14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol init +INFO: Initializing Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol start +INFO: Starting Coyote HTTP/1.1 on http-8085 +14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackComponent +14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM +apping +INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent +Main thread Thread[main,5,main] +aClientMethod on thread Thread[main,5,main] +aClientMethod return from someMethod on thread Thread[main,5,main] +Sleeping ... +setMyServiceCallback on thread Thread[pool-1-thread-1,5,main] +someMethod on thread Thread[pool-1-thread-1,5,main] +receiveResult on thread Thread[pool-1-thread-2,5,main] +Result: -> someMethod -> receiveResult +14-Jan-2008 14:26:31 org.apache.coyote.http11.Http11Protocol destroy +INFO: Stopping Coyote HTTP/1.1 on http-8085 +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.312 sec + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/simple-callback-ws/build.xml b/java/sca/contrib/samples/simple-callback-ws/build.xml new file mode 100644 index 0000000000..10b69bd395 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-callback-ws/pom.xml b/java/sca/contrib/samples/simple-callback-ws/pom.xml new file mode 100644 index 0000000000..5b5d5e666b --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-simple-callback-ws + Apache Tuscany SCA Simple Callback Web Service Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.png b/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.png new file mode 100644 index 0000000000..1b6353f5cf Binary files /dev/null and b/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.png differ diff --git a/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.svg b/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.svg new file mode 100644 index 0000000000..7d9e3de510 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/simple-callback-ws.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + simplecallback + MyServiceComponent + + + MyClientComponent + + + diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java new file mode 100644 index 0000000000..4cc00d6d0f --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java new file mode 100644 index 0000000000..7ecb51036f --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + System.out.println("aClientMethod on thread " + Thread.currentThread()); + myService.someMethod("-> someMethod"); + System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread()); + } + + public void receiveResult(String result) { + System.out.println("receiveResult on thread " + Thread.currentThread()); + System.out.println("Result: " + result); + MyClientImpl.result = result; + } +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java new file mode 100644 index 0000000000..7a72f50964 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; +import org.oasisopen.sca.annotation.Remotable; + +/** + * This service that will be invoked in a non-blocking fashion + */ +@Remotable +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java new file mode 100644 index 0000000000..dd26439619 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * The callback interface for {@link MyService}. + */ +@Remotable +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java new file mode 100644 index 0000000000..6a31d90458 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + private MyServiceCallback myServiceCallback; + + /** + * The setter used by the runtime to set the callback reference + * @param myServiceCallback + */ + @Callback + public void setMyServiceCallback(MyServiceCallback myServiceCallback) { + System.out.println("setMyServiceCallback on thread " + Thread.currentThread()); + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + System.out.println("someMethod on thread " + Thread.currentThread()); + // invoke the callback + try { + myServiceCallback.receiveResult(arg + " -> receiveResult"); + } catch(RuntimeException e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + e.printStackTrace(); + } + } +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java new file mode 100644 index 0000000000..eeb0e52163 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackClient { + + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite"); + MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + Thread.sleep(1000); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/resources/simplecallback.composite b/java/sca/contrib/samples/simple-callback-ws/src/main/resources/simplecallback.composite new file mode 100644 index 0000000000..53e7fe66af --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/resources/simplecallback.composite @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl b/java/sca/contrib/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl new file mode 100644 index 0000000000..8a6465de3a --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java b/java/sca/contrib/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java new file mode 100644 index 0000000000..580a7f6b0c --- /dev/null +++ b/java/sca/contrib/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * A testcase that demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackTestCase extends TestCase { + + private SCADomain scaDomain; + private MyClient myClient; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("simplecallback.composite"); + myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + System.out.println("Sleeping ..."); + Thread.sleep(2000); + assertEquals("-> someMethod -> receiveResult", MyClientImpl.result); + } +} + + diff --git a/java/sca/contrib/samples/simple-callback/README b/java/sca/contrib/samples/simple-callback/README new file mode 100644 index 0000000000..719376f254 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/README @@ -0,0 +1,97 @@ +Simple Callback Sample +====================== +This sample demonstrates asynchronous messaging using a callback. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient + + +Sample Overview +--------------- +The sample provides a single composite with two components. MyClientComponent is +wired to MyServiceComponent. The interface of MyServiceComponent describes one +method as ONEWAY and with a callback semantic. When a message passes from +client to service the response is returned via the callback asynchronously. + +simple-callback/ + src/ + main/ + java/ + simplecallback/ + MyClient.java - client interface + MyClientImpl.java - implements the client and service callback + interfaces + MyService.java - service interface + MyServiceCallback.java - service callback interface, implemented by the + client + MyServiceImpl.java - implements the service interface + SimpleCallbackClient.java - starts the SCA Runtime and + deploys the simplecallback.composite. + It then calls MyClientComponent which in turn + calls MyServiceComponent + resources/ + simplecallback.composite - the SCA assembly for this sample + test/ + java/ + simplecallback/ + SimpleCallbackTestCase.java - JUnit test case + simple-callback.png - a pictorial representation of the sample + .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd simple-callback +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Main thread Thread[main,5,main] + [java] Work thread Thread[pool-1-thread-1,5,main] + [java] Result: -> someMethod -> receiveResult + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd simple-callback +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running simplecallback.SimpleCallbackTestCase +Main thread Thread[main,5,main] +Sleeping ... +Work thread Thread[pool-1-thread-1,5,main] +Result: -> someMethod -> receiveResult +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.692 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. diff --git a/java/sca/contrib/samples/simple-callback/build.xml b/java/sca/contrib/samples/simple-callback/build.xml new file mode 100644 index 0000000000..47d1ea4bc1 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-callback/pom.xml b/java/sca/contrib/samples/simple-callback/pom.xml new file mode 100644 index 0000000000..056aef6a1e --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-simple-callback + Apache Tuscany SCA Simple Callback Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/simple-callback/simple-callback.png b/java/sca/contrib/samples/simple-callback/simple-callback.png new file mode 100644 index 0000000000..1b6353f5cf Binary files /dev/null and b/java/sca/contrib/samples/simple-callback/simple-callback.png differ diff --git a/java/sca/contrib/samples/simple-callback/simple-callback.svg b/java/sca/contrib/samples/simple-callback/simple-callback.svg new file mode 100644 index 0000000000..484b65df9d --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/simple-callback.svg @@ -0,0 +1,150 @@ + + + + + + + + + + image/svg+xml + + + + + + + + simplecallback + MyServiceComponent + + + MyClientComponent + + + diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClient.java new file mode 100644 index 0000000000..4cc00d6d0f --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClient.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +/** + * The client interface + */ +public interface MyClient { + + void aClientMethod(); +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java new file mode 100644 index 0000000000..18e159edc3 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * Demonstrates a component-to-component callback invocation + */ +@Service(MyClient.class) +@Scope("COMPOSITE") +public class MyClientImpl implements MyClient, MyServiceCallback { + + private MyService myService; + static String result; + + @Reference + public void setMyService(MyService myService) { + this.myService = myService; + } + + public void aClientMethod() { + myService.someMethod("-> someMethod"); + } + + public void receiveResult(String result) { + System.out.println("Work thread " + Thread.currentThread()); + System.out.println("Result: " + result); + MyClientImpl.result = result; + } +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyService.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyService.java new file mode 100644 index 0000000000..a065408954 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyService.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.OneWay; + +/** + * This service that will be invoked in a non-blocking fashion + */ +@Callback(MyServiceCallback.class) +public interface MyService { + + @OneWay + void someMethod(String arg); +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java new file mode 100644 index 0000000000..b27eea44f5 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +/** + * The callback interface for {@link MyService}. + */ +public interface MyServiceCallback { + + void receiveResult(String result); +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java new file mode 100644 index 0000000000..dc5493babe --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.oasisopen.sca.annotation.Callback; +import org.oasisopen.sca.annotation.Scope; +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements MyService and uses a callback. + */ +@Service(MyService.class) +@Scope("COMPOSITE") +public class MyServiceImpl implements MyService { + + private MyServiceCallback myServiceCallback; + + /** + * The setter used by the runtime to set the callback reference + * @param myServiceCallback + */ + @Callback + public void setMyServiceCallback(MyServiceCallback myServiceCallback) { + this.myServiceCallback = myServiceCallback; + } + + public void someMethod(String arg) { + // invoke the callback + try { + myServiceCallback.receiveResult(arg + " -> receiveResult"); + } catch(RuntimeException e) { + System.out.println("RuntimeException invoking receiveResult: " + e.toString()); + } + } +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java new file mode 100644 index 0000000000..b8987fcd07 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * Demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackClient { + + public static void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite"); + MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + Thread.sleep(500); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/simple-callback/src/main/resources/simplecallback.composite b/java/sca/contrib/samples/simple-callback/src/main/resources/simplecallback.composite new file mode 100644 index 0000000000..33e6f60601 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/main/resources/simplecallback.composite @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/java/sca/contrib/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java new file mode 100644 index 0000000000..cbaab8af83 --- /dev/null +++ b/java/sca/contrib/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package simplecallback; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * A testcase that demonstrates resolving the client service and initiating the callback sequence + */ +public class SimpleCallbackTestCase extends TestCase { + + private SCADomain scaDomain; + private MyClient myClient; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("simplecallback.composite"); + myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + System.out.println("Main thread " + Thread.currentThread()); + myClient.aClientMethod(); + System.out.println("Sleeping ..."); + Thread.sleep(300); + assertEquals("-> someMethod -> receiveResult", MyClientImpl.result); + } +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/pom.xml b/java/sca/contrib/samples/spi-implementation-pojo/pom.xml new file mode 100644 index 0000000000..870c67b5f2 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/pom.xml @@ -0,0 +1,59 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-spi-implementation-java + Apache Tuscany Java Implementation SPI Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-extension-helper + 2.0-SNAPSHOT + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java new file mode 100644 index 0000000000..73104c3166 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + + +public class JavaImplementation { + + private String className; + + public String getClass_() { + return className; + } + + public void setClass_(String className) { + this.className = className; + } + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java new file mode 100644 index 0000000000..43efae32ca --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.spi.ImplementationActivator; +import org.apache.tuscany.sca.spi.InvokerFactory; + +public class JavaImplementationActivator implements ImplementationActivator { + + public Class getImplementationClass() { + return JavaImplementation.class; + } + + public InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) { + return new JavaInvokerFactory(rc, ct, implementation); + } + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java new file mode 100644 index 0000000000..b33d9a3644 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import java.lang.reflect.Method; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.oasisopen.sca.ServiceRuntimeException; + +public class JavaInvoker implements Invoker { + + protected Class clazz; + protected Object instance; + protected Operation operation; + + public JavaInvoker(Class clazz, Object instance, Operation operation) { + this.clazz = clazz; + this.instance = instance; + this.operation = operation; + } + + public Message invoke(Message msg) { + try { + msg.setBody(getMethod().invoke(instance, (Object[])msg.getBody())); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + return msg; + } + + protected Method getMethod() { + for (Method method : clazz.getMethods()) { + if (method.getName().equals(operation.getName())) { + return method; + } + } + throw new ServiceRuntimeException("no method found for operation: " + operation.getName()); + } + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java new file mode 100644 index 0000000000..92c92eb309 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package sample; + +import org.apache.tuscany.sca.assembly.ComponentType; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.spi.InvokerFactory; +import org.oasisopen.sca.ServiceRuntimeException; + +public class JavaInvokerFactory implements InvokerFactory { + + protected Object instance; + protected Class clazz; + + public JavaInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) { + try { + this.clazz = Class.forName(implementation.getClass_()); + this.instance = clazz.newInstance(); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } + + public Invoker createInvoker(Operation operation) { + return new JavaInvoker(clazz, instance, operation); + } + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator b/java/sca/contrib/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator new file mode 100644 index 0000000000..95ee37c1aa --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# Implementation class for the ExtensionActivator +sample.JavaImplementationActivator diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java new file mode 100644 index 0000000000..cc32929f09 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +public interface HelloWorld { + + String sayHello(String name); + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java new file mode 100644 index 0000000000..02af1ccf22 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package helloworld; + +public class HelloWorldImpl implements HelloWorld { + + public String sayHello(String name) { + return "Hello " + name; + } + +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java new file mode 100644 index 0000000000..5813fda330 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package helloworld; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + */ +public class HelloWorldTestCase extends TestCase { + + public void testHello() throws Exception { + SCADomain scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); + HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); + assertEquals("Hello petra", helloworld.sayHello("petra")); + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite b/java/sca/contrib/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite new file mode 100644 index 0000000000..fa9cecc160 --- /dev/null +++ b/java/sca/contrib/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/README b/java/sca/contrib/samples/spring-bigbank-calculator/README new file mode 100644 index 0000000000..3869ea6a12 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/README @@ -0,0 +1,2 @@ +Spring-bigbank-calculator is part of a spring-bigbank sample. +Please see the Readme file under spring-bigbank to understand how spring-bigbank-calculator fits into the overall picture. diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/build.xml b/java/sca/contrib/samples/spring-bigbank-calculator/build.xml new file mode 100644 index 0000000000..9d69ee9ba0 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/pom.xml b/java/sca/contrib/samples/spring-bigbank-calculator/pom.xml new file mode 100644 index 0000000000..5f2b2452ab --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/pom.xml @@ -0,0 +1,110 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-spring-bigbank-calculator + Apache Tuscany SCA Spring-Based BigBank Calculator Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-script + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-rmi-runtime + 2.0-SNAPSHOT + runtime + + + + org.springframework + spring-core + 2.5.5 + + + + org.springframework + spring-beans + 2.5.5 + + + + org.springframework + spring-context + 2.5.5 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java new file mode 100644 index 0000000000..ecaa4e28de --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +public interface AddService { + + double add(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java new file mode 100644 index 0000000000..66a0ba0e63 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +/** + * The Calculator service interface. + */ +public interface CalculatorService { + + double add(double n1, double n2); + + double subtract(double n1, double n2); + + double multiply(double n1, double n2); + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java new file mode 100644 index 0000000000..665dbbf9ac --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +/** + * An implementation of the Calculator service. + */ +@Service(CalculatorService.class) +public class CalculatorServiceImpl implements CalculatorService { + + private AddService addService; + private SubtractService subtractService; + private MultiplyService multiplyService; + private DivideService divideService; + + @Reference + public void setAddService(AddService addService) { + this.addService = addService; + } + + @Reference + public void setSubtractService(SubtractService subtractService) { + this.subtractService = subtractService; + } + + @Reference + public void setDivideService(DivideService divideService) { + this.divideService = divideService; + } + + @Reference + public void setMultiplyService(MultiplyService multiplyService) { + this.multiplyService = multiplyService; + } + + public double add(double n1, double n2) { + return addService.add(n1, n2); + } + + public double subtract(double n1, double n2) { + return subtractService.subtract(n1, n2); + } + + public double multiply(double n1, double n2) { + System.err.println("Multiply"); + return multiplyService.multiply(n1, n2); + } + + public double divide(double n1, double n2) { + return divideService.divide(n1, n2); + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java new file mode 100644 index 0000000000..22e9d58a94 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +public interface DivideService { + + double divide(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java new file mode 100644 index 0000000000..ba3d43448e --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +public interface MultiplyService { + + double multiply(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java new file mode 100644 index 0000000000..17691af0e8 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +public interface SubtractService { + + double subtract(double n1, double n2); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java new file mode 100644 index 0000000000..c6a230fcb4 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.calculator.server; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class CalculatorServer { + + public static void main(String[] args) throws Exception { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } + + System.out.println("Starting the Sample SCA Calculator..."); + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorServer.class.getClassLoader()); + node.start(); + + if (timeout < 0) { + System.out.println("Press Enter to Exit..."); + System.in.read(); + } else { + Thread.sleep(timeout); + } + + node.stop(); + System.out.println("Bye"); + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite new file mode 100644 index 0000000000..504a4ccfcd --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml new file mode 100644 index 0000000000..42e5f824f9 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js new file mode 100644 index 0000000000..6f11106ddd --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +function add(n1, n2) { + return n1 + n2; +} \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy new file mode 100644 index 0000000000..c31c1e8fd6 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +def divide(n1, n2) { + return n1 / n2 +} \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py new file mode 100644 index 0000000000..cfd96f287a --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +def multiply(n1, n2): + print "Python Calculator component: multiply(", n1, ",", n2, ")" + return n1 * n2 \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb new file mode 100644 index 0000000000..8e7a884d41 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +def subtract(n1, n2) + print "Ruby Calculator subtract(", n1, ",", n2, ")\n" + return n1 - n2 +end \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java b/java/sca/contrib/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java new file mode 100644 index 0000000000..02a11485cd --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.calculator; + +import junit.framework.TestCase; +import bigbank.calculator.server.CalculatorServer; + +/** + * Tests out the big bank service + * + */ +public class CalculatorServiceTestCase extends TestCase { + + public void testServer() throws Exception { + CalculatorServer.main(new String[] {"1000"}); + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/README b/java/sca/contrib/samples/spring-bigbank-checkaccount/README new file mode 100644 index 0000000000..17b71e7590 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/README @@ -0,0 +1,4 @@ +Spring-bigbank-checkaccount is a part of a spring-bigbank sample. +Please see the Readme file under spring-bigbank to understand how spring-bigbank-checkaccount fits into the overall picture. + + diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/build.xml b/java/sca/contrib/samples/spring-bigbank-checkaccount/build.xml new file mode 100644 index 0000000000..26d71c146f --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/pom.xml b/java/sca/contrib/samples/spring-bigbank-checkaccount/pom.xml new file mode 100644 index 0000000000..b46074b8c8 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/pom.xml @@ -0,0 +1,133 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-spring-bigbank-checkaccount + Apache Tuscany SCA Spring-Based BigBank Checking Accounts Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-policy-security + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-core-spi + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jms-runtime + 2.0-SNAPSHOT + runtime + + + + org.springframework + spring-core + 2.5.5 + + + + org.springframework + spring-beans + 2.5.5 + + + + org.springframework + spring-context + 2.5.5 + + + + org.apache.ws.security + wss4j + 1.5.3 + + + + junit + junit + 4.5 + test + + + + org.apache.activemq + apache-activemq + 4.1.1 + + + org.apache.activemq + activemq-web-demo + + + + + + + ${artifactId} + + diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java new file mode 100644 index 0000000000..9737ac27eb --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +/** + * @version $$Rev: 635619 $$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr + * 2007) $$ + */ + +public class CheckingAccountDetails { + private String accountNumber; + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double b) { + this.balance = b; + } + + @Override + public String toString() { + return accountNumber + ", balance:" + balance; + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java new file mode 100644 index 0000000000..4d8b03fc7d --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import org.oasisopen.sca.annotation.Remotable; +import org.oasisopen.sca.annotation.Service; + +/** + * @version $$Rev: 636465 $$ $$Date: 2008-03-13 00:49:26 +0530 (Thu, 13 Mar 2008) $$ + */ +@Service +@Remotable +public interface CheckingAccountService { + + public CheckingAccountDetails getAccountDetails(String customerID); + + public double deposit(String accountNo, double depositAmt); + + public double withdraw(String accountNo, double withdrawalAmount); + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java new file mode 100644 index 0000000000..3ed3086dbd --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking; + +import java.util.HashMap; +import java.util.Map; + +import org.oasisopen.sca.annotation.Service; + +/** + * + * */ + +@Service(CheckingAccountService.class) +public class CheckingAccountServiceImpl implements CheckingAccountService { + private Map custAcctMap = new HashMap(); + private Map checkingAccts = new HashMap(); + + public CheckingAccountServiceImpl() { + custAcctMap.put("Customer_01", "CHA_Customer_01"); + custAcctMap.put("Customer_02", "CHA_Customer_02"); + custAcctMap.put("Customer_03", "CHA_Customer_03"); + + checkingAccts.put("CHA_Customer_01", new Double(1000)); + checkingAccts.put("CHA_Customer_02", new Double(1500)); + checkingAccts.put("CHA_Customer_03", new Double(2000)); + } + + public double deposit(String accountNo, double depositAmt) { + checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt)); + return checkingAccts.get(accountNo).doubleValue(); + } + + public CheckingAccountDetails getAccountDetails(String customerID) { + CheckingAccountDetails checkingAccount = new CheckingAccountDetails(); + checkingAccount.setAccountNumber(custAcctMap.get(customerID)); + checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue()); + + return checkingAccount; + } + + public double withdraw(String accountNo, double withdrawalAmount) { + double balance = checkingAccts.get(accountNo).doubleValue(); + if ( balance - withdrawalAmount > 0 ) { + balance = balance - withdrawalAmount; + checkingAccts.put(accountNo, balance); + } + return balance; + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java new file mode 100644 index 0000000000..562314230a --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java @@ -0,0 +1,70 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.checking.server; + +import java.io.IOException; + +import org.apache.activemq.broker.BrokerService; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +/** + * This server program shows how to create an SCA runtime, and start it which + * activates the Spring BigBank CheckingsAccount JMS endpoint. + */ +public class CheckingAccountServer { + + public static void main(String[] args) { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } + + try { + BrokerService jmsBroker; + jmsBroker = new BrokerService(); + jmsBroker.setPersistent(false); + jmsBroker.setUseJmx(false); + jmsBroker.addConnector("tcp://localhost:61619"); + jmsBroker.start(); + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANodeFromClassLoader("CheckingsAccount.composite", CheckingAccountServer.class.getClassLoader()); + node.start(); + + if (timeout < 0) { + System.out.println("CheckingsAccount server started (press enter to shutdown)"); + System.in.read(); + } else { + Thread.sleep(timeout); + } + + node.stop(); + + jmsBroker.stop(); + System.out.println("CheckingsAccount server stopped"); + + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java new file mode 100644 index 0000000000..ad17ab8cf5 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.security; + +import java.io.IOException; + +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.UnsupportedCallbackException; + +import org.apache.ws.security.WSPasswordCallback; + +/** + * Sample userid passwd generation class + */ +public class AccountsDataPasswordCallbackHandler implements CallbackHandler { + + public void handle(Callback[] callbacks) throws IOException, + UnsupportedCallbackException { + for (int i = 0; i < callbacks.length; i++) { + WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; + if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { + System.out.println(" Usage is SIGNATURE ... "); + pwcb.setPassword("bbservice"); + } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) { + System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = " + + pwcb.getIdentifer() + " and password = " + pwcb.getPassword() ); + if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) { + System.out.println("AUTHENTICATION SUCCESSFUL!"); + } else { + System.out.println("AUTHENTICATION FAILED!"); + throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!"); + } + } + } + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java new file mode 100644 index 0000000000..7b44a28bc9 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import java.security.Principal; +import java.util.Hashtable; +import java.util.Map; + +/** + * @version $Rev: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $ + */ +public class BigbankCheckingsAcl { + private static MapcheckingsAcl = new Hashtable(); + + static { + checkingsAcl.put("bbaservice", "Customer_01"); + checkingsAcl.put("bbUser01", "Customer_01"); + } + + + public static void authorize(Principal principal, String resource) { + if ( checkingsAcl.get(principal.getName()) == null || + !checkingsAcl.get(principal.getName()).equals(resource) ) { + throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " + + resource); + } else { + System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource); + } + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java new file mode 100644 index 0000000000..bbd5b0c325 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java @@ -0,0 +1,90 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import org.apache.tuscany.sca.assembly.ConfiguredOperation; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.assembly.OperationsConfigurator; +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Phase; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.runtime.RuntimeComponent; + +/** + * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ + */ +public class CheckingsDeptAuthImplementationPolicyProvider implements PolicyProvider { + private RuntimeComponent component; + private Implementation implementation; + + public CheckingsDeptAuthImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + super(); + this.component = component; + this.implementation = implementation; + } + + private String getContext() { + return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")"; + } + + private PolicySet findPolicySet(Operation operation) { + for (PolicySet ps : component.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (CheckingsDeptAuthPolicy.class.isInstance(p)) { + return ps; + } + } + } + + if ( component instanceof OperationsConfigurator ) { + for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) { + if ( confOp.getName().equals(operation.getName())) { + for (PolicySet ps : confOp.getPolicySets()) { + for (Object p : ps.getPolicies()) { + if (CheckingsDeptAuthPolicy.class.isInstance(p)) { + return ps; + } + } + } + } + } + } + + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) + */ + public Interceptor createInterceptor(Operation operation) { + PolicySet ps = findPolicySet(operation); + return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() + */ + public String getPhase() { + return Phase.IMPLEMENTATION_POLICY; + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java new file mode 100644 index 0000000000..cb26ca809d --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import javax.xml.namespace.QName; + +import org.apache.tuscany.sca.policy.Policy; + +/** + * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ + */ +public class CheckingsDeptAuthPolicy implements Policy { + + public QName getSchemaName() { + // TODO Auto-generated method stub + return null; + } + + public boolean isUnresolved() { + // TODO Auto-generated method stub + return false; + } + + public void setUnresolved(boolean unresolved) { + // TODO Auto-generated method stub + + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java new file mode 100644 index 0000000000..5c692df4ec --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java @@ -0,0 +1,73 @@ +package bigbank.account.security; + +import java.security.Principal; + +import org.apache.tuscany.sca.interfacedef.Operation; +import org.apache.tuscany.sca.invocation.Interceptor; +import org.apache.tuscany.sca.invocation.Invoker; +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.SecurityUtil; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Policy handler to handle PolicySet related to Logging with the QName + * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy + */ +public class CheckingsDeptAuthPolicyInterceptor implements Interceptor { + private Invoker next; + + public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) { + super(); + init(); + } + + private final void init() { + } + + public Message invoke(Message msg) { + Object msgBody = msg.getBody(); + if (msgBody instanceof Object[]) { + Object args[] = (Object[])msg.getBody(); + Principal principal = SecurityUtil.getPrincipal(msg); + if (principal != null){ + BigbankCheckingsAcl.authorize(principal, + (String)args[0]); + } + } + + Message responseMsg = null; + try { + responseMsg = getNext().invoke(msg); + return responseMsg; + } catch (RuntimeException e) { + throw e; + } + } + + public Invoker getNext() { + return next; + } + + public void setNext(Invoker next) { + this.next = next; + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java new file mode 100644 index 0000000000..24da9878a5 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import org.apache.tuscany.sca.assembly.Binding; +import org.apache.tuscany.sca.assembly.Implementation; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.provider.PolicyProvider; +import org.apache.tuscany.sca.provider.PolicyProviderFactory; +import org.apache.tuscany.sca.runtime.RuntimeComponent; +import org.apache.tuscany.sca.runtime.RuntimeComponentReference; +import org.apache.tuscany.sca.runtime.RuntimeComponentService; + +/** + * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ + */ +public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory { + private ExtensionPointRegistry registry; + + public CheckingsDeptAuthPolicyProviderFactory(ExtensionPointRegistry registry) { + super(); + this.registry = registry; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) + */ + public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { + return new CheckingsDeptAuthImplementationPolicyProvider(component, implementation); + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) + */ + public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, + RuntimeComponentReference reference, + Binding binding) { + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) + */ + public PolicyProvider createServicePolicyProvider(RuntimeComponent component, + RuntimeComponentService service, + Binding binding) { + return null; + } + + /** + * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() + */ + public Class getModelType() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java new file mode 100644 index 0000000000..b023adf907 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package bigbank.account.security; + +import java.security.Principal; + +import org.apache.tuscany.sca.invocation.Message; +import org.apache.tuscany.sca.policy.PolicySet; +import org.apache.tuscany.sca.policy.SecurityUtil; +import org.apache.tuscany.sca.policy.util.PolicyHandler; + +/** + * @version $Rev: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $ + */ +public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler { + private PolicySet applicablePolicySet = null; + + public void afterInvoke(Object... context) { + } + + public void beforeInvoke(Object... context) { + for ( int count = 0 ; count < context.length ; ++count ) { + if ( context[count] instanceof Message ) { + Message msg = (Message)context[count]; + Object args[] = (Object[])msg.getBody(); + Principal principal = SecurityUtil.getPrincipal(msg); + if (principal != null){ + BigbankCheckingsAcl.authorize(principal, + (String)args[0]); + } + } + } + } + + public void cleanUp(Object... arg0) { + } + + public PolicySet getApplicablePolicySet() { + return this.applicablePolicySet; + } + + public void setApplicablePolicySet(PolicySet policySet) { + this.applicablePolicySet = policySet; + } + + public void setUp(Object... arg0) { + + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java new file mode 100644 index 0000000000..96a5b2ca1f --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.account.security; + +import javax.xml.namespace.QName; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; +import org.apache.tuscany.sca.contribution.resolver.ModelResolver; +import org.apache.tuscany.sca.contribution.service.ContributionReadException; +import org.apache.tuscany.sca.contribution.service.ContributionResolveException; +import org.apache.tuscany.sca.contribution.service.ContributionWriteException; + +/** + * Implementation of a Policy Processor + * + */ +public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor { + private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy"); + public QName getArtifactType() { + return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME; + } + + public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) { + } + + + public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy(); + return policy; + } + + public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException, + XMLStreamException { + String prefix = "tuscany"; + writer.writeStartElement(prefix, + CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(), + CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI()); + writer.writeNamespace("chk", "http://bigbank/checkings"); + + + writer.writeEndElement(); + } + + public Class getModelType() { + return CheckingsDeptAuthPolicy.class; + } + + public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException { + + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite new file mode 100644 index 0000000000..371a1afd32 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..6491a0d326 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the artifact processor extension +bigbank.account.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler new file mode 100644 index 0000000000..b1bce4339d --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler @@ -0,0 +1,20 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures +# handler classname;qname=;model= +bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory new file mode 100644 index 0000000000..d6bfe2167e --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Implementation class for the policy extension +bigbank.account.security.CheckingsDeptAuthPolicyProviderFactory;model=bigbank.account.security.CheckingsDeptAuthPolicy \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml new file mode 100644 index 0000000000..0ce1440ddf --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml @@ -0,0 +1,58 @@ + + + + + + + + Authorization Intent + + + + + + + + + UsernameToken + bigbank.account.security.AccountsDataPasswordCallbackHandler + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml new file mode 100644 index 0000000000..6b2338f611 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java new file mode 100644 index 0000000000..a45630278b --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.checkaccount; + +import junit.framework.TestCase; +import bigbank.account.checking.server.CheckingAccountServer; + +/** + * Tests out the big bank service + * + */ +public class CheckAccountServiceTestCase extends TestCase { + + public void testServer() throws Exception { + CheckingAccountServer.main(new String[] {"1000"}); + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/README b/java/sca/contrib/samples/spring-bigbank-stockquote/README new file mode 100644 index 0000000000..b90bafeb59 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/README @@ -0,0 +1,4 @@ +Spring-bigbank-stockquote is a part of a spring-bigbank sample. +Please see the Readme file under spring-bigbank to understand how spring-bigbank-stockquote fits into the overall picture. + + diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/build.xml b/java/sca/contrib/samples/spring-bigbank-stockquote/build.xml new file mode 100644 index 0000000000..1b38a40495 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/pom.xml b/java/sca/contrib/samples/spring-bigbank-stockquote/pom.xml new file mode 100644 index 0000000000..4bf37e88fa --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/pom.xml @@ -0,0 +1,110 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-spring-bigbank-stockquote + Apache Tuscany SCA Spring-Based BigBank StockQuote Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + org.springframework + spring-core + 2.5.5 + + + + org.springframework + spring-beans + 2.5.5 + + + + org.springframework + spring-context + 2.5.5 + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java new file mode 100644 index 0000000000..833cc50f71 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + +import org.oasisopen.sca.annotation.Service; + +/** + * This class implements the StockQuote service. + */ +@Service(StockQuoteService.class) +public class StockQuoteImpl implements StockQuoteService { + + public double getQuote(String symbol) { + double price = 104.0 + Math.random(); + price = ((int)(price * 100)) / 100.0; + + System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); + + return price; + } + +} diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..d6db2bd182 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java new file mode 100644 index 0000000000..643f9a187c --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java @@ -0,0 +1,19 @@ +package bigbank.stockquote.server; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +public class SCAApplicationContextProvider implements ApplicationContextAware { + + private static ApplicationContext ctx; + + public void setApplicationContext(ApplicationContext appContext) throws BeansException { + // Wiring the ApplicationContext into a static method + ctx = appContext; + } + + public static ApplicationContext getApplicationContext() { + return ctx; + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java new file mode 100644 index 0000000000..da96f29b0c --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote.server; + +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.springframework.context.ApplicationContext; + +/** + * This server program shows how to bootstrap SCA from a simple J2SE program + * and start it which activates the StockQuote Web service endpoint. + */ +public class StockQuoteServer { + + public static void main(String[] args) throws Exception { + long timeout = -1L; + if (args.length > 0) { + timeout = Long.parseLong(args[0]); + } + + System.out.println("Starting the Sample SCA StockQuote Service..."); + + SCANodeFactory factory = SCANodeFactory.newInstance(); + SCANode node = factory.createSCANodeFromClassLoader("StockQuote.composite", StockQuoteServer.class.getClassLoader()); + node.start(); + + // Method 1: To access the Spring Application Context instance + ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext(); + if (ctx.containsBean("StockQuoteServiceBean")) + System.out.println("StockQuoteServiceBean is now available for use..."); + + if (timeout < 0) { + System.out.println("Press Enter to Exit..."); + System.in.read(); + } else { + Thread.sleep(timeout); + } + + node.stop(); + System.out.println("Bye"); + } +} diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml new file mode 100644 index 0000000000..87dd006b5a --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite new file mode 100644 index 0000000000..06544c6883 --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java b/java/sca/contrib/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java new file mode 100644 index 0000000000..4b36d0694d --- /dev/null +++ b/java/sca/contrib/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package bigbank.stockquote; + +import junit.framework.TestCase; +import bigbank.stockquote.server.StockQuoteServer; + +/** + * Tests out the big bank service + * + */ +public class StockQuoteServiceTestCase extends TestCase { + + public void testServer() throws Exception { + StockQuoteServer.main(new String[] {"1000"}); + } +} diff --git a/java/sca/contrib/samples/store-distributed/README b/java/sca/contrib/samples/store-distributed/README new file mode 100644 index 0000000000..46e71bf51e --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/README @@ -0,0 +1,28 @@ +Store Sample +====================================== + +This is a sample store scenario that is used as a getting started guide +for Tuscany SCA. For detailed information, please see: + +http://tuscany.apache.org/getting-started-with-tuscany.html + +or + +http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as follows: + +cd store +ant compile + +and then, to run: + +ant run + +Once the store application is running use your browser to visit the following +URL: + +http://localhost:8080/store/ diff --git a/java/sca/contrib/samples/store-distributed/build.xml b/java/sca/contrib/samples/store-distributed/build.xml new file mode 100644 index 0000000000..652afc3570 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/build.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/cloud.composite b/java/sca/contrib/samples/store-distributed/cloud.composite new file mode 100644 index 0000000000..7bd13d5b6f --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/cloud.composite @@ -0,0 +1,27 @@ + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/domain.composite b/java/sca/contrib/samples/store-distributed/domain.composite new file mode 100644 index 0000000000..6898c454af --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/domain.composite @@ -0,0 +1,27 @@ + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/pom.xml b/java/sca/contrib/samples/store-distributed/pom.xml new file mode 100644 index 0000000000..e812ae0b10 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/pom.xml @@ -0,0 +1,119 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../pom.xml + + sample-store-distributed + Apache Tuscany SCA Getting Started Online Store Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + + org.apache.tuscany.sca + tuscany-node-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-domain-manager + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-widget-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchDomain.java b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchDomain.java new file mode 100644 index 0000000000..dd19f6b49b --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchDomain.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package node; + +import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; + +/** + * This server program that loads a composite to provide simple registry function. + * This server can be replaced with any registry that is appropriate but the components + * in each node that talk to the registry should be replaced also. + */ +public class LaunchDomain { + public static void main(String[] args) throws Exception { + DomainManagerLauncher.main(args); + } + +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java new file mode 100644 index 0000000000..9016e515fb --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreNodeA { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeA"}); + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java new file mode 100644 index 0000000000..2b387aec82 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreNodeB { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeB"}); + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java new file mode 100644 index 0000000000..fb138e484f --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package node; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreNodeC { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"}); + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/Cart.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/Cart.java new file mode 100644 index 0000000000..3fb5439bc3 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/Cart.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Cart extends Collection { + +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/Catalog.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/Catalog.java new file mode 100644 index 0000000000..b5e504fe11 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/Catalog.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Catalog { + Item[] get(); +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverter.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverter.java new file mode 100644 index 0000000000..a064f3dd69 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverter.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CurrencyConverter { + public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); + + public String getCurrencySymbol(String currencyCode); +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java new file mode 100644 index 0000000000..c354aed447 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +public class CurrencyConverterImpl implements CurrencyConverter { + public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { + if (toCurrencyCode.equals("USD")) + return amount; + else if (toCurrencyCode.equals("EUR")) + return ((double)Math.round(amount * 0.7256 * 100)) /100; + return 0; + } + + public String getCurrencySymbol(String currencyCode) { + if (currencyCode.equals("USD")) + return "$"; + else if (currencyCode.equals("EUR")) + return "E"; //"€"; + return "?"; + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java new file mode 100644 index 0000000000..d132a24b00 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.util.ArrayList; +import java.util.List; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +public class FruitsCatalogImpl implements Catalog { + + @Property + public String currencyCode = "USD"; + + @Reference + public CurrencyConverter currencyConverter; + + private List catalog = new ArrayList(); + + @Init + public void init() { + String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); + catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); + catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); + catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); + } + + public Item[] get() { + Item[] catalogArray = new Item[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/Item.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/Item.java new file mode 100644 index 0000000000..27abd4f016 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/Item.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + + +public class Item { + private String name; + private String price; + + public Item() { + } + + public Item(String name, String price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java new file mode 100644 index 0000000000..698614212d --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartImpl implements Cart, Total { + + private Map cart; + + @Init + public void init() { + cart = new HashMap(); + } + + public Entry[] getAll() { + Entry[] entries = new Entry[cart.size()]; + int i = 0; + for (Map.Entry e: cart.entrySet()) { + entries[i++] = new Entry(e.getKey(), e.getValue()); + } + return entries; + } + + public Item get(String key) throws NotFoundException { + Item item = cart.get(key); + if (item == null) { + throw new NotFoundException(key); + } else { + return item; + } + } + + public String post(String key, Item item) { + if (key == null) { + key ="cart-" + UUID.randomUUID().toString(); + } + cart.put(key, item); + return key; + } + + public void put(String key, Item item) throws NotFoundException { + if (!cart.containsKey(key)) { + throw new NotFoundException(key); + } + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + if (key == null || key.equals("")) { + cart.clear(); + } else { + Item item = cart.remove(key); + if (item == null) + throw new NotFoundException(key); + } + } + + public Entry[] query(String queryString) { + List> entries = new ArrayList>(); + if (queryString.startsWith("name=")) { + String name = queryString.substring(5); + for (Map.Entry e: cart.entrySet()) { + Item item = e.getValue(); + if (item.getName().equals(name)) { + entries.add(new Entry(e.getKey(), e.getValue())); + } + } + } + return entries.toArray(new Entry[entries.size()]); + } + + public String getTotal() { + double total = 0; + String currencySymbol = ""; + if (!cart.isEmpty()) { + Item item = cart.values().iterator().next(); + currencySymbol = item.getPrice().substring(0, 1); + } + for (Item item : cart.values()) { + total += Double.valueOf(item.getPrice().substring(1)); + } + return currencySymbol + String.valueOf(total); + } +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/java/services/Total.java b/java/sca/contrib/samples/store-distributed/src/main/java/services/Total.java new file mode 100644 index 0000000000..b77cc1c7ac --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/java/services/Total.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Total { + + String getTotal(); + +} diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeA.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeA.composite new file mode 100644 index 0000000000..f7bfd0fcb6 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeA.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeB.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeB.composite new file mode 100644 index 0000000000..187c5caf1c --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeB.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeC.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeC.composite new file mode 100644 index 0000000000..98113a3576 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/cloud/NodeC.composite @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..f165ee0e29 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/store.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/store.composite new file mode 100644 index 0000000000..2ac608d43f --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeA/store.composite @@ -0,0 +1,38 @@ + + + + + + + USD + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..0f8e76ccd7 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/store.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/store.composite new file mode 100644 index 0000000000..062a7aa2cd --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeB/store.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..15bab17c1a --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/store.composite b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/store.composite new file mode 100644 index 0000000000..5de310128d --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/store.composite @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html new file mode 100644 index 0000000000..45604463d1 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html @@ -0,0 +1,162 @@ + + + +Store + + + + + + + + +

Store

+
+

Catalog

+
+
+
+ +
+ +
+ +

Your Shopping Cart

+
+
+
+
+
+ + + (feed) +
+
+ + diff --git a/java/sca/contrib/samples/store-distributed/src/main/resources/uiservices/store.html b/java/sca/contrib/samples/store-distributed/src/main/resources/uiservices/store.html new file mode 100644 index 0000000000..45604463d1 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/src/main/resources/uiservices/store.html @@ -0,0 +1,162 @@ + + + +Store + + + + + + + + +

Store

+
+

Catalog

+
+
+
+ +
+ +
+ +

Your Shopping Cart

+
+
+
+
+
+ + + (feed) +
+
+ + diff --git a/java/sca/contrib/samples/store-distributed/store.png b/java/sca/contrib/samples/store-distributed/store.png new file mode 100644 index 0000000000..da413edeee Binary files /dev/null and b/java/sca/contrib/samples/store-distributed/store.png differ diff --git a/java/sca/contrib/samples/store-distributed/store.svg b/java/sca/contrib/samples/store-distributed/store.svg new file mode 100644 index 0000000000..74f8ecd36d --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/store.svg @@ -0,0 +1,304 @@ + + + + + + + + + + image/svg+xml + + + + + + + + store + ufs + + ShoppingCart + + CurrencyConverter + + + + + + + + + + CurrenyCode HTTP JSONRPC Atom + + Catalog + + + + diff --git a/java/sca/contrib/samples/store-distributed/workspace.xml b/java/sca/contrib/samples/store-distributed/workspace.xml new file mode 100644 index 0000000000..d6cb2bfc81 --- /dev/null +++ b/java/sca/contrib/samples/store-distributed/workspace.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/java/sca/contrib/samples/store/README b/java/sca/contrib/samples/store/README new file mode 100644 index 0000000000..46e71bf51e --- /dev/null +++ b/java/sca/contrib/samples/store/README @@ -0,0 +1,28 @@ +Store Sample +====================================== + +This is a sample store scenario that is used as a getting started guide +for Tuscany SCA. For detailed information, please see: + +http://tuscany.apache.org/getting-started-with-tuscany.html + +or + +http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as follows: + +cd store +ant compile + +and then, to run: + +ant run + +Once the store application is running use your browser to visit the following +URL: + +http://localhost:8080/store/ diff --git a/java/sca/contrib/samples/store/build.xml b/java/sca/contrib/samples/store/build.xml new file mode 100644 index 0000000000..652afc3570 --- /dev/null +++ b/java/sca/contrib/samples/store/build.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store/pom.xml b/java/sca/contrib/samples/store/pom.xml new file mode 100644 index 0000000000..d68563807a --- /dev/null +++ b/java/sca/contrib/samples/store/pom.xml @@ -0,0 +1,106 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../pom.xml + + sample-store + Apache Tuscany SCA Getting Started Online Store Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-data-api + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-widget-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/store/src/main/java/launch/Launch.java b/java/sca/contrib/samples/store/src/main/java/launch/Launch.java new file mode 100644 index 0000000000..801697abea --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/launch/Launch.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class Launch { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("store.composite"); + System.out.println("store.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/Cart.java b/java/sca/contrib/samples/store/src/main/java/services/Cart.java new file mode 100644 index 0000000000..3fb5439bc3 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/Cart.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Cart extends Collection { + +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/Catalog.java b/java/sca/contrib/samples/store/src/main/java/services/Catalog.java new file mode 100644 index 0000000000..b5e504fe11 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/Catalog.java @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Catalog { + Item[] get(); +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverter.java b/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverter.java new file mode 100644 index 0000000000..a064f3dd69 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverter.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CurrencyConverter { + public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); + + public String getCurrencySymbol(String currencyCode); +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverterImpl.java b/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverterImpl.java new file mode 100644 index 0000000000..c354aed447 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/CurrencyConverterImpl.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +public class CurrencyConverterImpl implements CurrencyConverter { + public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { + if (toCurrencyCode.equals("USD")) + return amount; + else if (toCurrencyCode.equals("EUR")) + return ((double)Math.round(amount * 0.7256 * 100)) /100; + return 0; + } + + public String getCurrencySymbol(String currencyCode) { + if (currencyCode.equals("USD")) + return "$"; + else if (currencyCode.equals("EUR")) + return "E"; //"€"; + return "?"; + } +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/FruitsCatalogImpl.java b/java/sca/contrib/samples/store/src/main/java/services/FruitsCatalogImpl.java new file mode 100644 index 0000000000..d132a24b00 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/FruitsCatalogImpl.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.util.ArrayList; +import java.util.List; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; +import org.oasisopen.sca.annotation.Reference; + +public class FruitsCatalogImpl implements Catalog { + + @Property + public String currencyCode = "USD"; + + @Reference + public CurrencyConverter currencyConverter; + + private List catalog = new ArrayList(); + + @Init + public void init() { + String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); + catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); + catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); + catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); + } + + public Item[] get() { + Item[] catalogArray = new Item[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/Item.java b/java/sca/contrib/samples/store/src/main/java/services/Item.java new file mode 100644 index 0000000000..27abd4f016 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/Item.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + + +public class Item { + private String name; + private String price; + + public Item() { + } + + public Item(String name, String price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/ShoppingCartImpl.java b/java/sca/contrib/samples/store/src/main/java/services/ShoppingCartImpl.java new file mode 100644 index 0000000000..698614212d --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/ShoppingCartImpl.java @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartImpl implements Cart, Total { + + private Map cart; + + @Init + public void init() { + cart = new HashMap(); + } + + public Entry[] getAll() { + Entry[] entries = new Entry[cart.size()]; + int i = 0; + for (Map.Entry e: cart.entrySet()) { + entries[i++] = new Entry(e.getKey(), e.getValue()); + } + return entries; + } + + public Item get(String key) throws NotFoundException { + Item item = cart.get(key); + if (item == null) { + throw new NotFoundException(key); + } else { + return item; + } + } + + public String post(String key, Item item) { + if (key == null) { + key ="cart-" + UUID.randomUUID().toString(); + } + cart.put(key, item); + return key; + } + + public void put(String key, Item item) throws NotFoundException { + if (!cart.containsKey(key)) { + throw new NotFoundException(key); + } + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + if (key == null || key.equals("")) { + cart.clear(); + } else { + Item item = cart.remove(key); + if (item == null) + throw new NotFoundException(key); + } + } + + public Entry[] query(String queryString) { + List> entries = new ArrayList>(); + if (queryString.startsWith("name=")) { + String name = queryString.substring(5); + for (Map.Entry e: cart.entrySet()) { + Item item = e.getValue(); + if (item.getName().equals(name)) { + entries.add(new Entry(e.getKey(), e.getValue())); + } + } + } + return entries.toArray(new Entry[entries.size()]); + } + + public String getTotal() { + double total = 0; + String currencySymbol = ""; + if (!cart.isEmpty()) { + Item item = cart.values().iterator().next(); + currencySymbol = item.getPrice().substring(0, 1); + } + for (Item item : cart.values()) { + total += Double.valueOf(item.getPrice().substring(1)); + } + return currencySymbol + String.valueOf(total); + } +} diff --git a/java/sca/contrib/samples/store/src/main/java/services/Total.java b/java/sca/contrib/samples/store/src/main/java/services/Total.java new file mode 100644 index 0000000000..b77cc1c7ac --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/java/services/Total.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface Total { + + String getTotal(); + +} diff --git a/java/sca/contrib/samples/store/src/main/resources/store.composite b/java/sca/contrib/samples/store/src/main/resources/store.composite new file mode 100644 index 0000000000..571678839d --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/resources/store.composite @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + USD + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/store/src/main/resources/uiservices/store.html b/java/sca/contrib/samples/store/src/main/resources/uiservices/store.html new file mode 100644 index 0000000000..45604463d1 --- /dev/null +++ b/java/sca/contrib/samples/store/src/main/resources/uiservices/store.html @@ -0,0 +1,162 @@ + + + +Store + + + + + + + + +

Store

+
+

Catalog

+
+
+
+ +
+ +
+ +

Your Shopping Cart

+
+
+
+
+
+ + + (feed) +
+
+ + diff --git a/java/sca/contrib/samples/store/store.png b/java/sca/contrib/samples/store/store.png new file mode 100644 index 0000000000..da413edeee Binary files /dev/null and b/java/sca/contrib/samples/store/store.png differ diff --git a/java/sca/contrib/samples/store/store.svg b/java/sca/contrib/samples/store/store.svg new file mode 100644 index 0000000000..74f8ecd36d --- /dev/null +++ b/java/sca/contrib/samples/store/store.svg @@ -0,0 +1,304 @@ + + + + + + + + + + image/svg+xml + + + + + + + + store + ufs + + ShoppingCart + + CurrencyConverter + + + + + + + + + + CurrenyCode HTTP JSONRPC Atom + + Catalog + + + + diff --git a/java/sca/contrib/samples/supplychain/README b/java/sca/contrib/samples/supplychain/README new file mode 100644 index 0000000000..ea4493fdd4 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/README @@ -0,0 +1,101 @@ +SupplyChain Sample +================== + +This sample demonstrates SCA components using the asynchronous API. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-supplychain.jar supplychain.SupplyChainClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-supplychain.jar supplychain.SupplyChainClient + + +Sample Overview +--------------- + +The sample provides a Customer service with a purchaseGoods operation +and a notifyShipment operation annotated with the SCA @OneWay annotation. +The SupplyChainClient exercises this interface by calling the +purchaseGoods operation. This results in messages passing to +the Retailer, Warehouse, and Shipper components and the result returned +to the Customer service on a separate callback thread. + +supplychain/ + src/ + main/ + java/ + supplychain/ + Customer.java - Defines the Java interface implemented + by the Customer component + CustomerComponentImpl.java - Implements the SCA Customer component + Retailer.java - Defines the Java interface implemented + by the Retailer component + RetailerComponentImpl.java - Implements the SCA RetailerComponent component + Shipper.java - Defines the Java interface implemented + by the Shipper component + ShipperComponentImpl.java - Implements the SCA ShipperComponent component + SupplyChainClient.java - SupplyChainClient.java loads SCA runtime + Warehouse.java - Defines the Java interface implemented + by the Warehouse component + WarehouseComponentImpl.java - Implements the SCA WarehouseComponent component + + resources/ + supplychain.composite - the SCA assembly for this sample + test/ + java/ + supplychain/ + SupplyChainClientTestCase.java - JUnit test case + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant as +follows + +cd supplychain +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] Main thread Thread[main,5,main] + [java] Main thread sleeping ... + [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd supplychain +mvn + +You should see the following output from the test phase. + +------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running supplychain.SupplyChainClientTestCase +Main thread Thread[main,5,main] +Sleeping ... +Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.625 sec + +Results : + +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 + +This shows that the Junit test cases have run successfully. \ No newline at end of file diff --git a/java/sca/contrib/samples/supplychain/build.xml b/java/sca/contrib/samples/supplychain/build.xml new file mode 100644 index 0000000000..506180b8b1 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/supplychain/pom.xml b/java/sca/contrib/samples/supplychain/pom.xml new file mode 100644 index 0000000000..2e85d79793 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/pom.xml @@ -0,0 +1,65 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-supplychain + Apache Tuscany SCA Supply Chain Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Customer.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Customer.java new file mode 100644 index 0000000000..6c19a1108e --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Customer.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.oasisopen.sca.annotation.OneWay; + +/** + * This is the business interface of the Customer service component. + */ +public interface Customer { + + public void purchaseGoods(); + + @OneWay + public void notifyShipment(String order); + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java new file mode 100644 index 0000000000..0323cebe11 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.oasisopen.sca.annotation.Reference; + +/** + * This class implements the Customer service component. + */ +public class CustomerComponentImpl implements Customer { + + private Retailer retailer; + + @Reference + public void setRetailer(Retailer retailer) { + this.retailer = retailer; + } + + public void purchaseGoods() { + retailer.submitOrder("Order"); + } + + public void notifyShipment(String order) { + System.out.print("Work thread " + Thread.currentThread() + " - "); + System.out.println(order); + } + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Retailer.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Retailer.java new file mode 100644 index 0000000000..1add63fb4e --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Retailer.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Retailer service component. + */ +public interface Retailer { + + public void submitOrder(String order); + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java new file mode 100644 index 0000000000..809e2b7b89 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.oasisopen.sca.annotation.Reference; + +/** + * This class implements the Customer service component. + */ +public class RetailerComponentImpl implements Retailer { + + private Warehouse warehouse; + + @Reference + public void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; + } + + public void submitOrder(String order) { + warehouse.fulfillOrder(order + ", submitted"); + } + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Shipper.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Shipper.java new file mode 100644 index 0000000000..d4d49a922b --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Shipper.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Shipper service component. + */ +public interface Shipper { + + public void processShipment(String order); + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java new file mode 100644 index 0000000000..59513eca5d --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.oasisopen.sca.annotation.Reference; + +/** + * This class implements the Warehouse service component. + */ +public class ShipperComponentImpl implements Shipper { + + private Customer customer; + + @Reference + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public void processShipment(String order) { + customer.notifyShipment(order + ", shipped"); + } + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java new file mode 100644 index 0000000000..7072f582d1 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate a Customer service component and invoke it. + */ +public class SupplyChainClient { + + public static final void main(String[] args) throws Exception { + SCADomain scaDomain = SCADomain.newInstance("supplychain.composite"); + Customer customer = scaDomain.getService(Customer.class, "CustomerComponent"); + + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + System.out.println("Main thread sleeping ..."); + Thread.sleep(1000); + + scaDomain.close(); + } +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Warehouse.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Warehouse.java new file mode 100644 index 0000000000..0be499f569 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/Warehouse.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +/** + * This is the business interface of the Warehouse service component. + */ +public interface Warehouse { + + public void fulfillOrder(String order); + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java new file mode 100644 index 0000000000..ff4f5e62eb --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import org.oasisopen.sca.annotation.Reference; + +/** + * This class implements the Warehouse service component. + */ +public class WarehouseComponentImpl implements Warehouse { + + private Shipper shipper; + + @Reference + public void setShipper(Shipper shipper) { + this.shipper = shipper; + } + + public void fulfillOrder(String order) { + shipper.processShipment(order + ", fulfilled"); + } + +} diff --git a/java/sca/contrib/samples/supplychain/src/main/resources/supplychain.composite b/java/sca/contrib/samples/supplychain/src/main/resources/supplychain.composite new file mode 100644 index 0000000000..301efcaf1f --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/main/resources/supplychain.composite @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/java/sca/contrib/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java new file mode 100644 index 0000000000..88e0eb7ab8 --- /dev/null +++ b/java/sca/contrib/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package supplychain; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program shows how to create an SCA runtime, start it, + * locate a the Customer service component and invoke it. + */ +public class SupplyChainClientTestCase extends TestCase { + + private SCADomain scaDomain; + private Customer customer; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("supplychain.composite"); + customer = scaDomain.getService(Customer.class, "CustomerComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + + System.out.println("Main thread " + Thread.currentThread()); + customer.purchaseGoods(); + System.out.println("Sleeping ..."); + Thread.sleep(1000); + } +} diff --git a/java/sca/contrib/samples/supplychain/supplychain.png b/java/sca/contrib/samples/supplychain/supplychain.png new file mode 100644 index 0000000000..51a384e827 Binary files /dev/null and b/java/sca/contrib/samples/supplychain/supplychain.png differ diff --git a/java/sca/contrib/samples/supplychain/supplychain.svg b/java/sca/contrib/samples/supplychain/supplychain.svg new file mode 100644 index 0000000000..f72e77acab --- /dev/null +++ b/java/sca/contrib/samples/supplychain/supplychain.svg @@ -0,0 +1,228 @@ + + + + + + + + + + image/svg+xml + + + + + + + + supplychain + + CustomerComponent + + + RetailerComponent + + + WharehouseComponent + + + ShipperComponent + + + + + + + diff --git a/java/sca/contrib/samples/web-resource/README b/java/sca/contrib/samples/web-resource/README new file mode 100644 index 0000000000..56bffba6a3 --- /dev/null +++ b/java/sca/contrib/samples/web-resource/README @@ -0,0 +1,76 @@ +Web Resource Component Sample +====================================== +This sample demonstrates an SCA Web resource component. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-web-resource.jar web.resource.SampleServer + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-web-resource.jar web.resource.SampleServer + +Now the server is started you can point your Web browser to the URL of the Web resource. + +Sample Overview +--------------- +The sample provides a single component exposing a Web resource. + +web-resource/ + src/ + main/ + java/ + web/resource/ + SampleServer.java - starts the SCA Runtime and + deploys the WebResource.composite + resources/ + myContent/ + index.html - a Web HTML resource + WebResource.composite - the SCA assembly for this sample + web-resource.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd web-resource +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/* + [java] Sample server started (press enter to shutdown) + [java] + [java] To get the Web resource, point your Web browser to the following add +ress: + [java] http://localhost:8080/myWeb/index.html + [java] + +As this point the Web resource is exposed by a web server started automatically +by the SCA runtime. To stop the server just press enter. + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built using +Maven as follows. + +cd web-resource +mvn + diff --git a/java/sca/contrib/samples/web-resource/build.xml b/java/sca/contrib/samples/web-resource/build.xml new file mode 100644 index 0000000000..5f6b6091e7 --- /dev/null +++ b/java/sca/contrib/samples/web-resource/build.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/web-resource/pom.xml b/java/sca/contrib/samples/web-resource/pom.xml new file mode 100644 index 0000000000..eaa6269819 --- /dev/null +++ b/java/sca/contrib/samples/web-resource/pom.xml @@ -0,0 +1,79 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-web-resource + Apache Tuscany SCA Web Resource Sample + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-tomcat + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + diff --git a/java/sca/contrib/samples/web-resource/src/main/java/web/resource/SampleServer.java b/java/sca/contrib/samples/web-resource/src/main/java/web/resource/SampleServer.java new file mode 100644 index 0000000000..9410de08c4 --- /dev/null +++ b/java/sca/contrib/samples/web-resource/src/main/java/web/resource/SampleServer.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package web.resource; + +import java.io.IOException; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +public class SampleServer { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("WebResource.composite"); + + try { + System.out.println("Sample server started (press enter to shutdown)"); + System.out.println(); + System.out.println("To get the Web resource, point your Web browser to the following address:"); + System.out.println("http://localhost:8080/myWeb/index.html"); + System.out.println(); + System.in.read(); + } catch (IOException e) { + e.printStackTrace(); + } + + scaDomain.close(); + System.out.println("Sample server stopped"); + } +} diff --git a/java/sca/contrib/samples/web-resource/src/main/resources/WebResource.composite b/java/sca/contrib/samples/web-resource/src/main/resources/WebResource.composite new file mode 100644 index 0000000000..4536136a8b --- /dev/null +++ b/java/sca/contrib/samples/web-resource/src/main/resources/WebResource.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/web-resource/src/main/resources/myContent/index.html b/java/sca/contrib/samples/web-resource/src/main/resources/myContent/index.html new file mode 100644 index 0000000000..55de048373 --- /dev/null +++ b/java/sca/contrib/samples/web-resource/src/main/resources/myContent/index.html @@ -0,0 +1,49 @@ + + + + Tuscany Sample Web Resource + + + +

A Sample Web Resource

+ +

Tuscany allows you to publish Web resources using SCA components declared with an + <implementation.resource> component implementation type and made available + to HTTP clients using a <binding.http> binding.

+ +

Here is the SCA composite that publishes this page:

+ +
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+  targetNamespace="http://web"
+  name="WebResource">
+
+  <component name="myWeb">
+    <implementation.resource location="myContent"/>
+    <service name="Resource">
+      <binding.http/>
+    </service>
+  </component>      
+
+</composite>
+  	
+ + + diff --git a/java/sca/contrib/samples/web-resource/web-resource.png b/java/sca/contrib/samples/web-resource/web-resource.png new file mode 100644 index 0000000000..7259447b65 Binary files /dev/null and b/java/sca/contrib/samples/web-resource/web-resource.png differ diff --git a/java/sca/contrib/samples/web-resource/web-resource.svg b/java/sca/contrib/samples/web-resource/web-resource.svg new file mode 100644 index 0000000000..0d1257316c --- /dev/null +++ b/java/sca/contrib/samples/web-resource/web-resource.svg @@ -0,0 +1,197 @@ + + + + + + + + + + image/svg+xml + + + + + + + + WebResource + + + myWeb + implementation.resource + + File System + ./myContent /index.html + + binding.http + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/LICENSE b/java/sca/contrib/samples/zipcode-jaxws/LICENSE new file mode 100644 index 0000000000..6e529a25c4 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/LICENSE @@ -0,0 +1,205 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/NOTICE b/java/sca/contrib/samples/zipcode-jaxws/NOTICE new file mode 100644 index 0000000000..51042eab05 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/NOTICE @@ -0,0 +1,6 @@ +${pom.name} +Copyright (c) 2005 - 2009 The Apache Software Foundation + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org/). + diff --git a/java/sca/contrib/samples/zipcode-jaxws/README b/java/sca/contrib/samples/zipcode-jaxws/README new file mode 100644 index 0000000000..12f81543f0 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/README @@ -0,0 +1,72 @@ +ZipCode JAX-WS Sample +====================================== +This sample demonstrates how to access an existing web service using JAX-WS/JAXB generated java interfaces/classes. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +If you just want to run it to see what happens open a command prompt, navigate +to this sample directory and do: + +ant run + +OR if you don't have ant, on Windows do + +java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-zipcode-jaxws.jar zipcode.ZipCodeClient + +and on *nix do + +java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-zipcode-jaxws.jar zipcode.ZipCodeClient + + +Sample Overview +--------------- +The sample provides a single component exposing a Web resource. + +zipcode-jaxws/ + src/ + main/ + java/ + + resources/ + ZipCode.composite - the SCA assembly for this sample + zipcode-jaxws.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file + pom.xml - the Maven build file + + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built and run using Ant using the +following commands + +cd zipcode-jaxws +ant compile +ant run + +You should see the following output from the run target. + +run: + [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a +ddServletMapping + [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/* + [java] Sample server started (press enter to shutdown) + [java] + [java] To get the Web resource, point your Web browser to the following add +ress: + [java] http://localhost:8080/myWeb/index.html + [java] + +As this point the Web resource is exposed by a web server started automatically +by the SCA runtime. To stop the server just press enter. + +Building The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built using +Maven as follows. + +cd zipcode-jaxws +mvn + diff --git a/java/sca/contrib/samples/zipcode-jaxws/build.xml b/java/sca/contrib/samples/zipcode-jaxws/build.xml new file mode 100644 index 0000000000..85caf5954e --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/build.xml @@ -0,0 +1,68 @@ + + +]> + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/pom.xml b/java/sca/contrib/samples/zipcode-jaxws/pom.xml new file mode 100644 index 0000000000..686b948d03 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/pom.xml @@ -0,0 +1,245 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../../pom.xml + + sample-zipcode-jaxws + jar + Apache Tuscany SCA US Zip Code JAX-WS Sample + Apache Tuscany SCA US Zip Code JAX-WS Sample + + + + org.apache.tuscany.sca + tuscany-host-embedded + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + + java.net + java.net Maven 1.x Repository + http://download.java.net/maven/1 + legacy + + + java.net2 + java.net Maven 2.x Repository + http://download.java.net/maven/2 + + + + + + java.net2 + java.net Maven 2.x Repository + http://download.java.net/maven/2 + + + + + + ${artifactId} + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.1 + + + + install-wsdl + validate + + run + + + + + + + + + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 2.0-SNAPSHOT + + + + location.LocationClient + true + + + generate + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -Djava.endorsed.dirs=target/endorsed + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + generate-sources + + copy + + + + + javax.xml.ws + jaxws-api + 2.1 + jar + + + javax.xml.bind + jaxb-api + 2.1 + jar + + + ${project.build.directory}/endorsed + false + true + + + + + + + + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java new file mode 100644 index 0000000000..8c9a48bf40 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="USAreaCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "usAreaCode" +}) +@XmlRootElement(name = "GetInfoByAreaCode") +public class GetInfoByAreaCode { + + @XmlElement(name = "USAreaCode") + protected String usAreaCode; + + /** + * Gets the value of the usAreaCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUSAreaCode() { + return usAreaCode; + } + + /** + * Sets the value of the usAreaCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUSAreaCode(String value) { + this.usAreaCode = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java new file mode 100644 index 0000000000..93847c8809 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetInfoByAreaCodeResult" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <any/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getInfoByAreaCodeResult" +}) +@XmlRootElement(name = "GetInfoByAreaCodeResponse") +public class GetInfoByAreaCodeResponse { + + @XmlElement(name = "GetInfoByAreaCodeResult") + protected GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getInfoByAreaCodeResult; + + /** + * Gets the value of the getInfoByAreaCodeResult property. + * + * @return + * possible object is + * {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } + * + */ + public GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getGetInfoByAreaCodeResult() { + return getInfoByAreaCodeResult; + } + + /** + * Sets the value of the getInfoByAreaCodeResult property. + * + * @param value + * allowed object is + * {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } + * + */ + public void setGetInfoByAreaCodeResult(GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult value) { + this.getInfoByAreaCodeResult = value; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <any/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "content" + }) + public static class GetInfoByAreaCodeResult { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + + /** + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getContent().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * {@link Object } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java new file mode 100644 index 0000000000..cf9276d417 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="USCity" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "usCity" +}) +@XmlRootElement(name = "GetInfoByCity") +public class GetInfoByCity { + + @XmlElement(name = "USCity") + protected String usCity; + + /** + * Gets the value of the usCity property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUSCity() { + return usCity; + } + + /** + * Sets the value of the usCity property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUSCity(String value) { + this.usCity = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java new file mode 100644 index 0000000000..9dc0e41b2b --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetInfoByCityResult" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <any/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getInfoByCityResult" +}) +@XmlRootElement(name = "GetInfoByCityResponse") +public class GetInfoByCityResponse { + + @XmlElement(name = "GetInfoByCityResult") + protected GetInfoByCityResponse.GetInfoByCityResult getInfoByCityResult; + + /** + * Gets the value of the getInfoByCityResult property. + * + * @return + * possible object is + * {@link GetInfoByCityResponse.GetInfoByCityResult } + * + */ + public GetInfoByCityResponse.GetInfoByCityResult getGetInfoByCityResult() { + return getInfoByCityResult; + } + + /** + * Sets the value of the getInfoByCityResult property. + * + * @param value + * allowed object is + * {@link GetInfoByCityResponse.GetInfoByCityResult } + * + */ + public void setGetInfoByCityResult(GetInfoByCityResponse.GetInfoByCityResult value) { + this.getInfoByCityResult = value; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <any/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "content" + }) + public static class GetInfoByCityResult { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + + /** + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getContent().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * {@link Object } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java new file mode 100644 index 0000000000..48be94b14a --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="USState" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "usState" +}) +@XmlRootElement(name = "GetInfoByState") +public class GetInfoByState { + + @XmlElement(name = "USState") + protected String usState; + + /** + * Gets the value of the usState property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUSState() { + return usState; + } + + /** + * Sets the value of the usState property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUSState(String value) { + this.usState = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java new file mode 100644 index 0000000000..1645e11ca2 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetInfoByStateResult" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <any/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getInfoByStateResult" +}) +@XmlRootElement(name = "GetInfoByStateResponse") +public class GetInfoByStateResponse { + + @XmlElement(name = "GetInfoByStateResult") + protected GetInfoByStateResponse.GetInfoByStateResult getInfoByStateResult; + + /** + * Gets the value of the getInfoByStateResult property. + * + * @return + * possible object is + * {@link GetInfoByStateResponse.GetInfoByStateResult } + * + */ + public GetInfoByStateResponse.GetInfoByStateResult getGetInfoByStateResult() { + return getInfoByStateResult; + } + + /** + * Sets the value of the getInfoByStateResult property. + * + * @param value + * allowed object is + * {@link GetInfoByStateResponse.GetInfoByStateResult } + * + */ + public void setGetInfoByStateResult(GetInfoByStateResponse.GetInfoByStateResult value) { + this.getInfoByStateResult = value; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <any/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "content" + }) + public static class GetInfoByStateResult { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + + /** + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getContent().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * {@link Object } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java new file mode 100644 index 0000000000..45c948b4b4 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="USZip" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "usZip" +}) +@XmlRootElement(name = "GetInfoByZIP") +public class GetInfoByZIP { + + @XmlElement(name = "USZip") + protected String usZip; + + /** + * Gets the value of the usZip property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUSZip() { + return usZip; + } + + /** + * Sets the value of the usZip property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUSZip(String value) { + this.usZip = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java new file mode 100644 index 0000000000..9e78dc6d0a --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java @@ -0,0 +1,158 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetInfoByZIPResult" minOccurs="0">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <any/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getInfoByZIPResult" +}) +@XmlRootElement(name = "GetInfoByZIPResponse") +public class GetInfoByZIPResponse { + + @XmlElement(name = "GetInfoByZIPResult") + protected GetInfoByZIPResponse.GetInfoByZIPResult getInfoByZIPResult; + + /** + * Gets the value of the getInfoByZIPResult property. + * + * @return + * possible object is + * {@link GetInfoByZIPResponse.GetInfoByZIPResult } + * + */ + public GetInfoByZIPResponse.GetInfoByZIPResult getGetInfoByZIPResult() { + return getInfoByZIPResult; + } + + /** + * Sets the value of the getInfoByZIPResult property. + * + * @param value + * allowed object is + * {@link GetInfoByZIPResponse.GetInfoByZIPResult } + * + */ + public void setGetInfoByZIPResult(GetInfoByZIPResponse.GetInfoByZIPResult value) { + this.getInfoByZIPResult = value; + } + + + /** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <any/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "content" + }) + public static class GetInfoByZIPResult { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + + /** + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getContent().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * {@link Object } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java new file mode 100644 index 0000000000..ced83ff09a --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.xml.bind.annotation.XmlRegistry; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.example.uszip package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.example.uszip + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link GetInfoByCity } + * + */ + public GetInfoByCity createGetInfoByCity() { + return new GetInfoByCity(); + } + + /** + * Create an instance of {@link GetInfoByState } + * + */ + public GetInfoByState createGetInfoByState() { + return new GetInfoByState(); + } + + /** + * Create an instance of {@link GetInfoByZIPResponse.GetInfoByZIPResult } + * + */ + public GetInfoByZIPResponse.GetInfoByZIPResult createGetInfoByZIPResponseGetInfoByZIPResult() { + return new GetInfoByZIPResponse.GetInfoByZIPResult(); + } + + /** + * Create an instance of {@link GetInfoByStateResponse.GetInfoByStateResult } + * + */ + public GetInfoByStateResponse.GetInfoByStateResult createGetInfoByStateResponseGetInfoByStateResult() { + return new GetInfoByStateResponse.GetInfoByStateResult(); + } + + /** + * Create an instance of {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } + * + */ + public GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult createGetInfoByAreaCodeResponseGetInfoByAreaCodeResult() { + return new GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult(); + } + + /** + * Create an instance of {@link GetInfoByZIP } + * + */ + public GetInfoByZIP createGetInfoByZIP() { + return new GetInfoByZIP(); + } + + /** + * Create an instance of {@link GetInfoByAreaCodeResponse } + * + */ + public GetInfoByAreaCodeResponse createGetInfoByAreaCodeResponse() { + return new GetInfoByAreaCodeResponse(); + } + + /** + * Create an instance of {@link GetInfoByCityResponse } + * + */ + public GetInfoByCityResponse createGetInfoByCityResponse() { + return new GetInfoByCityResponse(); + } + + /** + * Create an instance of {@link GetInfoByStateResponse } + * + */ + public GetInfoByStateResponse createGetInfoByStateResponse() { + return new GetInfoByStateResponse(); + } + + /** + * Create an instance of {@link GetInfoByCityResponse.GetInfoByCityResult } + * + */ + public GetInfoByCityResponse.GetInfoByCityResult createGetInfoByCityResponseGetInfoByCityResult() { + return new GetInfoByCityResponse.GetInfoByCityResult(); + } + + /** + * Create an instance of {@link GetInfoByZIPResponse } + * + */ + public GetInfoByZIPResponse createGetInfoByZIPResponse() { + return new GetInfoByZIPResponse(); + } + + /** + * Create an instance of {@link GetInfoByAreaCode } + * + */ + public GetInfoByAreaCode createGetInfoByAreaCode() { + return new GetInfoByAreaCode(); + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java new file mode 100644 index 0000000000..22493ba9b8 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.3-b02- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "USZip", targetNamespace = "http://www.webserviceX.NET", wsdlLocation = "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl") +public class USZip + extends Service +{ + + private final static URL USZIP_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.example.uszip.USZip.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.example.uszip.USZip.class.getResource("."); + url = new URL(baseUrl, "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + USZIP_WSDL_LOCATION = url; + } + + public USZip(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public USZip() { + super(USZIP_WSDL_LOCATION, new QName("http://www.webserviceX.NET", "USZip")); + } + + /** + * + * @return + * returns USZipSoap + */ + @WebEndpoint(name = "USZipSoap") + public USZipSoap getUSZipSoap() { + return super.getPort(new QName("http://www.webserviceX.NET", "USZipSoap"), USZipSoap.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns USZipSoap + */ + @WebEndpoint(name = "USZipSoap") + public USZipSoap getUSZipSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://www.webserviceX.NET", "USZipSoap"), USZipSoap.class, features); + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java new file mode 100644 index 0000000000..5ac370005f --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.uszip; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +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- + * Generated source version: 2.1 + * + */ +@WebService(name = "USZipSoap", targetNamespace = "http://www.webserviceX.NET") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface USZipSoap { + + + /** + * Get State Code,City,Area Code,Time Zone,Zip Code by Zip Code + * + * @param usZip + * @return + * returns com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult + */ + @WebMethod(operationName = "GetInfoByZIP", action = "http://www.webserviceX.NET/GetInfoByZIP") + @WebResult(name = "GetInfoByZIPResult", targetNamespace = "http://www.webserviceX.NET") + @RequestWrapper(localName = "GetInfoByZIP", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByZIP") + @ResponseWrapper(localName = "GetInfoByZIPResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByZIPResponse") + public com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult getInfoByZIP( + @WebParam(name = "USZip", targetNamespace = "http://www.webserviceX.NET") + String usZip); + + /** + * Get State Code,City,Area Code,Time Zone,Zip Code by City + * + * @param usCity + * @return + * returns com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult + */ + @WebMethod(operationName = "GetInfoByCity", action = "http://www.webserviceX.NET/GetInfoByCity") + @WebResult(name = "GetInfoByCityResult", targetNamespace = "http://www.webserviceX.NET") + @RequestWrapper(localName = "GetInfoByCity", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByCity") + @ResponseWrapper(localName = "GetInfoByCityResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByCityResponse") + public com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult getInfoByCity( + @WebParam(name = "USCity", targetNamespace = "http://www.webserviceX.NET") + String usCity); + + /** + * Get State Code,City,Area Code,Time Zone,Zip Code by state + * + * @param usState + * @return + * returns com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult + */ + @WebMethod(operationName = "GetInfoByState", action = "http://www.webserviceX.NET/GetInfoByState") + @WebResult(name = "GetInfoByStateResult", targetNamespace = "http://www.webserviceX.NET") + @RequestWrapper(localName = "GetInfoByState", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByState") + @ResponseWrapper(localName = "GetInfoByStateResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByStateResponse") + public com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult getInfoByState( + @WebParam(name = "USState", targetNamespace = "http://www.webserviceX.NET") + String usState); + + /** + * Get State Code,City,Area Code,Time Zone,Zip Code by Area Code + * + * @param usAreaCode + * @return + * returns com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult + */ + @WebMethod(operationName = "GetInfoByAreaCode", action = "http://www.webserviceX.NET/GetInfoByAreaCode") + @WebResult(name = "GetInfoByAreaCodeResult", targetNamespace = "http://www.webserviceX.NET") + @RequestWrapper(localName = "GetInfoByAreaCode", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByAreaCode") + @ResponseWrapper(localName = "GetInfoByAreaCodeResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByAreaCodeResponse") + public com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getInfoByAreaCode( + @WebParam(name = "USAreaCode", targetNamespace = "http://www.webserviceX.NET") + String usAreaCode); + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java new file mode 100644 index 0000000000..d120f34ee5 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webserviceX.NET", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.example.uszip; diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java new file mode 100644 index 0000000000..5385fb57be --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for ArrayOfWeatherData complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="ArrayOfWeatherData">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="WeatherData" type="{http://www.webservicex.net}WeatherData" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ArrayOfWeatherData", propOrder = { + "weatherData" +}) +public class ArrayOfWeatherData { + + @XmlElement(name = "WeatherData") + protected List weatherData; + + /** + * Gets the value of the weatherData property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the weatherData property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getWeatherData().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link WeatherData } + * + * + */ + public List getWeatherData() { + if (weatherData == null) { + weatherData = new ArrayList(); + } + return this.weatherData; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java new file mode 100644 index 0000000000..9eb205e75d --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="PlaceName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "placeName" +}) +@XmlRootElement(name = "GetWeatherByPlaceName") +public class GetWeatherByPlaceName { + + @XmlElement(name = "PlaceName") + protected String placeName; + + /** + * Gets the value of the placeName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlaceName() { + return placeName; + } + + /** + * Sets the value of the placeName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlaceName(String value) { + this.placeName = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java new file mode 100644 index 0000000000..e281509623 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetWeatherByPlaceNameResult" type="{http://www.webservicex.net}WeatherForecasts"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getWeatherByPlaceNameResult" +}) +@XmlRootElement(name = "GetWeatherByPlaceNameResponse") +public class GetWeatherByPlaceNameResponse { + + @XmlElement(name = "GetWeatherByPlaceNameResult", required = true) + protected WeatherForecasts getWeatherByPlaceNameResult; + + /** + * Gets the value of the getWeatherByPlaceNameResult property. + * + * @return + * possible object is + * {@link WeatherForecasts } + * + */ + public WeatherForecasts getGetWeatherByPlaceNameResult() { + return getWeatherByPlaceNameResult; + } + + /** + * Sets the value of the getWeatherByPlaceNameResult property. + * + * @param value + * allowed object is + * {@link WeatherForecasts } + * + */ + public void setGetWeatherByPlaceNameResult(WeatherForecasts value) { + this.getWeatherByPlaceNameResult = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java new file mode 100644 index 0000000000..08d4a70364 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ZipCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "zipCode" +}) +@XmlRootElement(name = "GetWeatherByZipCode") +public class GetWeatherByZipCode { + + @XmlElement(name = "ZipCode") + protected String zipCode; + + /** + * Gets the value of the zipCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getZipCode() { + return zipCode; + } + + /** + * Sets the value of the zipCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setZipCode(String value) { + this.zipCode = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java new file mode 100644 index 0000000000..9288f5332e --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for anonymous complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="GetWeatherByZipCodeResult" type="{http://www.webservicex.net}WeatherForecasts"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "getWeatherByZipCodeResult" +}) +@XmlRootElement(name = "GetWeatherByZipCodeResponse") +public class GetWeatherByZipCodeResponse { + + @XmlElement(name = "GetWeatherByZipCodeResult", required = true) + protected WeatherForecasts getWeatherByZipCodeResult; + + /** + * Gets the value of the getWeatherByZipCodeResult property. + * + * @return + * possible object is + * {@link WeatherForecasts } + * + */ + public WeatherForecasts getGetWeatherByZipCodeResult() { + return getWeatherByZipCodeResult; + } + + /** + * Sets the value of the getWeatherByZipCodeResult property. + * + * @param value + * allowed object is + * {@link WeatherForecasts } + * + */ + public void setGetWeatherByZipCodeResult(WeatherForecasts value) { + this.getWeatherByZipCodeResult = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java new file mode 100644 index 0000000000..0c4fdbcde1 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java @@ -0,0 +1,118 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.example.weather package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _WeatherForecasts_QNAME = new QName("http://www.webservicex.net", "WeatherForecasts"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.example.weather + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link WeatherData } + * + */ + public WeatherData createWeatherData() { + return new WeatherData(); + } + + /** + * Create an instance of {@link GetWeatherByPlaceName } + * + */ + public GetWeatherByPlaceName createGetWeatherByPlaceName() { + return new GetWeatherByPlaceName(); + } + + /** + * Create an instance of {@link GetWeatherByPlaceNameResponse } + * + */ + public GetWeatherByPlaceNameResponse createGetWeatherByPlaceNameResponse() { + return new GetWeatherByPlaceNameResponse(); + } + + /** + * Create an instance of {@link GetWeatherByZipCodeResponse } + * + */ + public GetWeatherByZipCodeResponse createGetWeatherByZipCodeResponse() { + return new GetWeatherByZipCodeResponse(); + } + + /** + * Create an instance of {@link GetWeatherByZipCode } + * + */ + public GetWeatherByZipCode createGetWeatherByZipCode() { + return new GetWeatherByZipCode(); + } + + /** + * Create an instance of {@link WeatherForecasts } + * + */ + public WeatherForecasts createWeatherForecasts() { + return new WeatherForecasts(); + } + + /** + * Create an instance of {@link ArrayOfWeatherData } + * + */ + public ArrayOfWeatherData createArrayOfWeatherData() { + return new ArrayOfWeatherData(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link WeatherForecasts }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.webservicex.net", name = "WeatherForecasts") + public JAXBElement createWeatherForecasts(WeatherForecasts value) { + return new JAXBElement(_WeatherForecasts_QNAME, WeatherForecasts.class, null, value); + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java new file mode 100644 index 0000000000..a4ca6190b5 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java @@ -0,0 +1,219 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for WeatherData complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="WeatherData">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Day" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="WeatherImage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="MaxTemperatureF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="MinTemperatureF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="MaxTemperatureC" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="MinTemperatureC" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WeatherData", propOrder = { + "day", + "weatherImage", + "maxTemperatureF", + "minTemperatureF", + "maxTemperatureC", + "minTemperatureC" +}) +public class WeatherData { + + @XmlElement(name = "Day") + protected String day; + @XmlElement(name = "WeatherImage") + protected String weatherImage; + @XmlElement(name = "MaxTemperatureF") + protected String maxTemperatureF; + @XmlElement(name = "MinTemperatureF") + protected String minTemperatureF; + @XmlElement(name = "MaxTemperatureC") + protected String maxTemperatureC; + @XmlElement(name = "MinTemperatureC") + protected String minTemperatureC; + + /** + * Gets the value of the day property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDay() { + return day; + } + + /** + * Sets the value of the day property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDay(String value) { + this.day = value; + } + + /** + * Gets the value of the weatherImage property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getWeatherImage() { + return weatherImage; + } + + /** + * Sets the value of the weatherImage property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setWeatherImage(String value) { + this.weatherImage = value; + } + + /** + * Gets the value of the maxTemperatureF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxTemperatureF() { + return maxTemperatureF; + } + + /** + * Sets the value of the maxTemperatureF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxTemperatureF(String value) { + this.maxTemperatureF = value; + } + + /** + * Gets the value of the minTemperatureF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMinTemperatureF() { + return minTemperatureF; + } + + /** + * Sets the value of the minTemperatureF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMinTemperatureF(String value) { + this.minTemperatureF = value; + } + + /** + * Gets the value of the maxTemperatureC property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMaxTemperatureC() { + return maxTemperatureC; + } + + /** + * Sets the value of the maxTemperatureC property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMaxTemperatureC(String value) { + this.maxTemperatureC = value; + } + + /** + * Gets the value of the minTemperatureC property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMinTemperatureC() { + return minTemperatureC; + } + + /** + * Sets the value of the minTemperatureC property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMinTemperatureC(String value) { + this.minTemperatureC = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java new file mode 100644 index 0000000000..0902ce67fe --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * Get one week weather forecast for valid zip code or Place name in USA + * + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.3-b02- + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "WeatherForecast", targetNamespace = "http://www.webservicex.net", wsdlLocation = "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl") +public class WeatherForecast + extends Service +{ + + private final static URL WEATHERFORECAST_WSDL_LOCATION; + private final static Logger logger = Logger.getLogger(com.example.weather.WeatherForecast.class.getName()); + + static { + URL url = null; + try { + URL baseUrl; + baseUrl = com.example.weather.WeatherForecast.class.getResource("."); + url = new URL(baseUrl, "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl"); + } catch (MalformedURLException e) { + logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl', retrying as a local file"); + logger.warning(e.getMessage()); + } + WEATHERFORECAST_WSDL_LOCATION = url; + } + + public WeatherForecast(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + public WeatherForecast() { + super(WEATHERFORECAST_WSDL_LOCATION, new QName("http://www.webservicex.net", "WeatherForecast")); + } + + /** + * + * @return + * returns WeatherForecastSoap + */ + @WebEndpoint(name = "WeatherForecastSoap") + public WeatherForecastSoap getWeatherForecastSoap() { + return super.getPort(new QName("http://www.webservicex.net", "WeatherForecastSoap"), WeatherForecastSoap.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns WeatherForecastSoap + */ + @WebEndpoint(name = "WeatherForecastSoap") + public WeatherForecastSoap getWeatherForecastSoap(WebServiceFeature... features) { + return super.getPort(new QName("http://www.webservicex.net", "WeatherForecastSoap"), WeatherForecastSoap.class, features); + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java new file mode 100644 index 0000000000..aa000a44d2 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +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- + * Generated source version: 2.1 + * + */ +@WebService(name = "WeatherForecastSoap", targetNamespace = "http://www.webservicex.net") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface WeatherForecastSoap { + + + /** + * Get one week weather forecast for a valid Zip Code(USA) + * + * @param zipCode + * @return + * returns com.example.weather.WeatherForecasts + */ + @WebMethod(operationName = "GetWeatherByZipCode", action = "http://www.webservicex.net/GetWeatherByZipCode") + @WebResult(name = "GetWeatherByZipCodeResult", targetNamespace = "http://www.webservicex.net") + @RequestWrapper(localName = "GetWeatherByZipCode", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByZipCode") + @ResponseWrapper(localName = "GetWeatherByZipCodeResponse", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByZipCodeResponse") + public WeatherForecasts getWeatherByZipCode( + @WebParam(name = "ZipCode", targetNamespace = "http://www.webservicex.net") + String zipCode); + + /** + * Get one week weather forecast for a place name(USA) + * + * @param placeName + * @return + * returns com.example.weather.WeatherForecasts + */ + @WebMethod(operationName = "GetWeatherByPlaceName", action = "http://www.webservicex.net/GetWeatherByPlaceName") + @WebResult(name = "GetWeatherByPlaceNameResult", targetNamespace = "http://www.webservicex.net") + @RequestWrapper(localName = "GetWeatherByPlaceName", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByPlaceName") + @ResponseWrapper(localName = "GetWeatherByPlaceNameResponse", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByPlaceNameResponse") + public WeatherForecasts getWeatherByPlaceName( + @WebParam(name = "PlaceName", targetNamespace = "http://www.webservicex.net") + String placeName); + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java new file mode 100644 index 0000000000..8ded0946d9 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java @@ -0,0 +1,251 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.example.weather; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for WeatherForecasts complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="WeatherForecasts">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Latitude" type="{http://www.w3.org/2001/XMLSchema}float"/>
+ *         <element name="Longitude" type="{http://www.w3.org/2001/XMLSchema}float"/>
+ *         <element name="AllocationFactor" type="{http://www.w3.org/2001/XMLSchema}float"/>
+ *         <element name="FipsCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="PlaceName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="StateCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="Details" type="{http://www.webservicex.net}ArrayOfWeatherData" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "WeatherForecasts", propOrder = { + "latitude", + "longitude", + "allocationFactor", + "fipsCode", + "placeName", + "stateCode", + "status", + "details" +}) +public class WeatherForecasts { + + @XmlElement(name = "Latitude") + protected float latitude; + @XmlElement(name = "Longitude") + protected float longitude; + @XmlElement(name = "AllocationFactor") + protected float allocationFactor; + @XmlElement(name = "FipsCode") + protected String fipsCode; + @XmlElement(name = "PlaceName") + protected String placeName; + @XmlElement(name = "StateCode") + protected String stateCode; + @XmlElement(name = "Status") + protected String status; + @XmlElement(name = "Details") + protected ArrayOfWeatherData details; + + /** + * Gets the value of the latitude property. + * + */ + public float getLatitude() { + return latitude; + } + + /** + * Sets the value of the latitude property. + * + */ + public void setLatitude(float value) { + this.latitude = value; + } + + /** + * Gets the value of the longitude property. + * + */ + public float getLongitude() { + return longitude; + } + + /** + * Sets the value of the longitude property. + * + */ + public void setLongitude(float value) { + this.longitude = value; + } + + /** + * Gets the value of the allocationFactor property. + * + */ + public float getAllocationFactor() { + return allocationFactor; + } + + /** + * Sets the value of the allocationFactor property. + * + */ + public void setAllocationFactor(float value) { + this.allocationFactor = value; + } + + /** + * Gets the value of the fipsCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFipsCode() { + return fipsCode; + } + + /** + * Sets the value of the fipsCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFipsCode(String value) { + this.fipsCode = value; + } + + /** + * Gets the value of the placeName property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlaceName() { + return placeName; + } + + /** + * Sets the value of the placeName property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlaceName(String value) { + this.placeName = value; + } + + /** + * Gets the value of the stateCode property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStateCode() { + return stateCode; + } + + /** + * Sets the value of the stateCode property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStateCode(String value) { + this.stateCode = value; + } + + /** + * Gets the value of the status property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatus() { + return status; + } + + /** + * Sets the value of the status property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatus(String value) { + this.status = value; + } + + /** + * Gets the value of the details property. + * + * @return + * possible object is + * {@link ArrayOfWeatherData } + * + */ + public ArrayOfWeatherData getDetails() { + return details; + } + + /** + * Sets the value of the details property. + * + * @param value + * allowed object is + * {@link ArrayOfWeatherData } + * + */ + public void setDetails(ArrayOfWeatherData value) { + this.details = value; + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java new file mode 100644 index 0000000000..6543ed7abf --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java @@ -0,0 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webservicex.net", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.example.weather; diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/LocationClient.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/LocationClient.java new file mode 100644 index 0000000000..35c114093a --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/LocationClient.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package location; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import com.example.uszip.GetInfoByZIPResponse; +import com.example.uszip.USZipSoap; + +/** + * This client program to invoke the Mortgage LoanApproval service + */ +public class LocationClient { + + public static void main(String[] args) throws Exception { + + SCADomain domain = SCADomain.newInstance("USLocation.composite"); + USZipSoap zipService = domain.getService(USZipSoap.class, "USLocationService"); + + GetInfoByZIPResponse.GetInfoByZIPResult result = zipService.getInfoByZIP("94555"); + + GetInfoByZIPResponse response = new GetInfoByZIPResponse(); + response.setGetInfoByZIPResult(result); + + JAXBContext context = JAXBContext.newInstance(GetInfoByZIPResponse.class); + StringWriter writer = new StringWriter(); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(response, writer); + + String xml = writer.toString(); + System.out.println(xml); + } +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java new file mode 100644 index 0000000000..8865d5fe82 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package location; + +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +import com.example.uszip.USZipSoap; +import com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult; +import com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult; +import com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult; +import com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult; + +/** + * @version $Rev$ $Date$ + */ +@Service(USZipSoap.class) +@AllowsPassByReference +public class USLocationImpl implements USZipSoap { + @Reference + protected USZipSoap usZipService; + + public GetInfoByAreaCodeResult getInfoByAreaCode(String usAreaCode) { + return usZipService.getInfoByAreaCode(usAreaCode); + } + + public GetInfoByCityResult getInfoByCity(String usCity) { + return usZipService.getInfoByCity(usCity); + } + + public GetInfoByStateResult getInfoByState(String usState) { + return usZipService.getInfoByState(usState); + } + + public GetInfoByZIPResult getInfoByZIP(String usZip) { + return usZipService.getInfoByZIP(usZip); + } +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java new file mode 100644 index 0000000000..c03cf2955f --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java @@ -0,0 +1,60 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package weather; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import com.example.weather.GetWeatherByZipCodeResponse; +import com.example.weather.WeatherForecastSoap; +import com.example.weather.WeatherForecasts; + +/** + * This client program to invoke the Mortgage LoanApproval service + */ +public class WeatherForecastClient { + + public static void main(String[] args) throws Exception { + + SCADomain domain = SCADomain.newInstance("WeatherForecast.composite"); + WeatherForecastSoap weatherService = domain.getService(WeatherForecastSoap.class, "WeatherForecastService"); + + WeatherForecasts result = weatherService.getWeatherByZipCode("94555"); + + // Dump the result as XML + + // Wrap the result so that it can be marshaled + GetWeatherByZipCodeResponse response = new GetWeatherByZipCodeResponse(); + response.setGetWeatherByZipCodeResult(result); + + // Marshal the JAXB object into XML + JAXBContext context = JAXBContext.newInstance(GetWeatherByZipCodeResponse.class); + StringWriter writer = new StringWriter(); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(response, writer); + + String xml = writer.toString(); + System.out.println(xml); + } +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java new file mode 100644 index 0000000000..5ad5f11344 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package weather; + +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +import com.example.weather.WeatherForecastSoap; +import com.example.weather.WeatherForecasts; + +/** + * @version $Rev$ $Date$ + */ +@Service(WeatherForecastSoap.class) +public class WeatherForecastImpl implements WeatherForecastSoap{ + @Reference + protected WeatherForecastSoap weatherForecast; + + public WeatherForecasts getWeatherByPlaceName(String placeName) { + return weatherForecast.getWeatherByPlaceName(placeName); + } + + public WeatherForecasts getWeatherByZipCode(String zipCode) { + return weatherForecast.getWeatherByZipCode(zipCode); + } +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java new file mode 100644 index 0000000000..f181d9bd0e --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package zipcode; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This client program to invoke the Mortgage LoanApproval service + */ +public class ZipCodeClient { + + public static void main(String[] args) throws Exception { + + System.out.println("Please wait..."); + + SCADomain domain = SCADomain.newInstance("ZipCode.composite"); + ZipCodeService zipService = domain.getService(ZipCodeService.class, "ZipCodeService"); + + String result = zipService.lookup("94555"); + System.out.println(result); + } +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java new file mode 100644 index 0000000000..53c112b8a3 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package zipcode; + +import org.oasisopen.sca.annotation.Remotable; + +/** + * @version $Rev$ $Date$ + */ +@Remotable +public interface ZipCodeService { + String lookup(String zipCode); +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java new file mode 100644 index 0000000000..7c68a77cf2 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package zipcode; + +import java.io.StringWriter; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Marshaller; + +import org.oasisopen.sca.ServiceRuntimeException; +import org.oasisopen.sca.annotation.AllowsPassByReference; +import org.oasisopen.sca.annotation.Reference; +import org.oasisopen.sca.annotation.Service; + +import com.example.uszip.GetInfoByZIPResponse; +import com.example.uszip.USZipSoap; +import com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult; +import com.example.weather.GetWeatherByZipCodeResponse; +import com.example.weather.WeatherForecastSoap; +import com.example.weather.WeatherForecasts; + +/** + * @version $Rev$ $Date$ + */ +@Service(ZipCodeService.class) +@AllowsPassByReference +public class ZipCodeServiceImpl implements ZipCodeService { + @Reference + protected USZipSoap usZipService; + + @Reference + protected WeatherForecastSoap weatherForecast; + + public String lookup(String zipCode) { + GetInfoByZIPResult result1 = usZipService.getInfoByZIP(zipCode); + + GetInfoByZIPResponse response1 = new GetInfoByZIPResponse(); + response1.setGetInfoByZIPResult(result1); + + String xml1 = toXML(response1); + + WeatherForecasts result2 = weatherForecast.getWeatherByZipCode(zipCode); + // Wrap the result so that it can be marshaled + GetWeatherByZipCodeResponse response2 = new GetWeatherByZipCodeResponse(); + response2.setGetWeatherByZipCodeResult(result2); + + String xml2 = toXML(response2); + // Marshal the JAXB object into XML + return xml1 + "\n" + xml2; + } + + private String toXML(Object jaxb) { + try { + JAXBContext context = JAXBContext.newInstance(jaxb.getClass()); + StringWriter writer = new StringWriter(); + Marshaller marshaller = context.createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); + marshaller.marshal(jaxb, writer); + return writer.toString(); + } catch (Exception e) { + throw new ServiceRuntimeException(e); + } + } + +} diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/USLocation.composite b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/USLocation.composite new file mode 100644 index 0000000000..a171fe62c9 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/USLocation.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite new file mode 100644 index 0000000000..0e1b118e44 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/ZipCode.composite b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/ZipCode.composite new file mode 100644 index 0000000000..28d674c29b --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/main/resources/ZipCode.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + diff --git a/java/sca/contrib/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java b/java/sca/contrib/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java new file mode 100644 index 0000000000..019fce26d6 --- /dev/null +++ b/java/sca/contrib/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package zipcode; + +import location.LocationClient; +import weather.WeatherForecastClient; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Tests that the callback server is available + */ +public class ZipCodeClientTestCase { + + @Before + public void startServer() throws Exception { + } + + @Test + public void testClient() throws Exception { + /* + System.out.println("Running LocationClient..."); + LocationClient.main(null); + System.out.println("Running WeatherForecastClient..."); + WeatherForecastClient.main(null); + */ + System.out.println("Running ZipCodeClient..."); + ZipCodeClient.main(null); + } + + @After + public void stopServer() throws Exception { + } +} diff --git a/java/sca/samples/binding-echo-extension/README b/java/sca/samples/binding-echo-extension/README deleted file mode 100644 index 94716b151f..0000000000 --- a/java/sca/samples/binding-echo-extension/README +++ /dev/null @@ -1,74 +0,0 @@ -Binding Echo Sample -=================== -This sample demonstrates how new bindings are constructed for Apache Tuscany -SCA. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you want to try out the echo binding that this sample provides -please see the binding-echo sample that provides the necessary client and -application code to bring up an application that uses this binding - -Sample Overview ---------------- -This sample contains a implementation of an SCA binding that simply echoes back -any messages that are sent to it. - -binding-echo-extension/ - src/ - main/ - java/ - echo/ - The binding interfaces - impl/ - The bindings model classes - provider/ - The bindings runtime classes - server/ - A dummy server that the binding is plugged into - resources/ - META-INF/ - services/ - The extension declaration - test/ - java/ - echo/ - test code - resources/ - EchoBinding.composite - the SCA assembly used by the unit test - build.xml - the Ant build file - pom.xml - the Maven build file - -Building The Sample Using Ant ------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd binding-echo-extension -ant compile - -See the binding-echo sample to run a sample that uses this binding. - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd binding-echo-extension -mvn - -Maven will also test that the sample extension built properly. You should see -the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running echo.EchoServiceTestCase -Returned message: oof -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.011 sec -Running echo.EchoReferenceTestCase -Returned message: oof -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.06 sec - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/binding-echo-extension/build.xml b/java/sca/samples/binding-echo-extension/build.xml deleted file mode 100644 index 5df5981bea..0000000000 --- a/java/sca/samples/binding-echo-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-echo-extension/pom.xml b/java/sca/samples/binding-echo-extension/pom.xml deleted file mode 100644 index 5d5ba0865f..0000000000 --- a/java/sca/samples/binding-echo-extension/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-binding-echo-extension - Apache Tuscany SCA Echo Binding Extension Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-assembly-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java deleted file mode 100644 index 3fe1598e0d..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo; - -import org.apache.tuscany.sca.assembly.Binding; - -/** - * A model for the sample Echo binding. - */ -public interface EchoBinding extends Binding { - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java deleted file mode 100644 index 0f6fee82be..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo; - -/** - * A factory for the sample Echo binding model. - */ -public interface EchoBindingFactory { - - /** - * Creates a new Echo binding. - * - * @return a new Echo binding - */ - EchoBinding createEchoBinding(); -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java deleted file mode 100644 index af759dbf93..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.impl; - -import echo.EchoBinding; -import echo.EchoBindingFactory; - -/** - * A factory for the sample Echo binding model. - */ -public class EchoBindingFactoryImpl implements EchoBindingFactory { - - public EchoBinding createEchoBinding() { - return new EchoBindingImpl(); - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java deleted file mode 100644 index 19c9271bb8..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; - -import echo.EchoBinding; - -/** - * Implementation of the Echo binding model. - */ -public class EchoBindingImpl implements EchoBinding, PolicySetAttachPoint { - - private String name; - private String uri; - private List requiredIntents = new ArrayList(); - private List policySets = new ArrayList(); - private List applicablePolicySets = new ArrayList(); - private IntentAttachPointType bindingType = null; - - public IntentAttachPointType getType() { - return bindingType; - } - - public void setType(IntentAttachPointType type) { - this.bindingType = type; - } - - public String getName() { - return name; - } - - public String getURI() { - return uri; - } - - public void setName(String name) { - this.name = name; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public List getPolicySets() { - return policySets; - } - - public List getRequiredIntents() { - return requiredIntents; - } - - public boolean isUnresolved() { - // The sample binding is always resolved - return false; - } - - public void setUnresolved(boolean unresolved) { - // The sample binding is always resolved - } - - public void setPolicySets(List policySets) { - this.policySets = policySets; - - } - - public void setRequiredIntents(List intents) { - this.requiredIntents = intents; - - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - public List getApplicablePolicySets() { - return this.applicablePolicySets; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java deleted file mode 100644 index 45fdb73f67..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.policy.Intent; -import org.apache.tuscany.sca.policy.PolicyFactory; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.policy.IntentAttachPointType; -import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl; - -import echo.EchoBinding; -import echo.EchoBindingFactory; - -/** - * A processor for elements. - */ -public class EchoBindingProcessor implements StAXArtifactProcessor { - - private QName BINDING_ECHO = new QName("http://echo", "binding.echo"); - - private final EchoBindingFactory factory; - private PolicyAttachPointProcessor policyProcessor; - - public EchoBindingProcessor(EchoBindingFactory factory, PolicyFactory policyFactory) { - this.factory = factory; - this.policyProcessor = new PolicyAttachPointProcessor(policyFactory); - } - - public QName getArtifactType() { - return BINDING_ECHO; - } - - public Class getModelType() { - return EchoBinding.class; - } - - public EchoBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - EchoBinding echoBinding = factory.createEchoBinding(); - IntentAttachPointType bindingType = new IntentAttachPointTypeFactoryImpl().createBindingType(); - bindingType.setName(getArtifactType()); - bindingType.setUnresolved(true); - ((PolicySetAttachPoint)echoBinding).setType(bindingType); - - String name = reader.getAttributeValue(null, "name"); - if (name != null) { - echoBinding.setName(name); - } - - String uri = reader.getAttributeValue(null, "uri"); - if (uri != null) { - echoBinding.setURI(uri); - } - - policyProcessor.readPolicies(echoBinding, reader); - - return echoBinding; - } - - public void write(EchoBinding echoBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - policyProcessor.writePolicyPrefixes(echoBinding, writer); - writer.writeStartElement(BINDING_ECHO.getNamespaceURI(), BINDING_ECHO.getLocalPart()); - policyProcessor.writePolicyAttributes(echoBinding, writer); - - if (echoBinding.getName() != null) { - writer.writeAttribute("name", echoBinding.getName()); - } - - if (echoBinding.getURI() != null) { - writer.writeAttribute("uri", echoBinding.getURI()); - } - - writer.writeEndElement(); - } - - public void resolve(EchoBinding echoBinding, ModelResolver resolver) throws ContributionResolveException { - PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)echoBinding; - List requiredIntents = new ArrayList(); - Intent resolvedIntent = null; - for ( Intent intent : policySetAttachPoint.getRequiredIntents() ) { - resolvedIntent = resolver.resolveModel(Intent.class, intent); - requiredIntents.add(resolvedIntent); - } - policySetAttachPoint.getRequiredIntents().clear(); - policySetAttachPoint.getRequiredIntents().addAll(requiredIntents); - - List resolvedPolicySets = new ArrayList(); - PolicySet resolvedPolicySet = null; - for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) { - resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet); - resolvedPolicySets.add(resolvedPolicySet); - } - policySetAttachPoint.getPolicySets().clear(); - policySetAttachPoint.getPolicySets().addAll(resolvedPolicySets); - } -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java deleted file mode 100644 index 91697fcd9a..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider; - -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -/** - * Invoker for the sample echo binding. - */ -class EchoBindingInvoker implements Invoker { - - EchoBindingInvoker() { - } - - public Message invoke(Message msg) { - try { - System.out.println("Passing thro invoker..."); - Object[] args = msg.getBody(); - - // echo back the first parameter, a real binding would invoke some API for flowing the request - Object result = args[0]; - - msg.setBody(result); - - } catch (Exception e) { - msg.setFaultBody(e); - } - return msg; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java deleted file mode 100644 index 4877bade7f..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; - -import echo.provider.policy.PolicyHandler; -import echo.provider.policy.EncryptionPolicyHandler; - -/** - * Invoker that applies policies before invocation for the sample echo binding. - */ -public class EchoBindingPoliciedInvoker implements Invoker { - List policies = null; - Map policyHandlers = new HashMap(); - - public EchoBindingPoliciedInvoker(List policies) { - this.policies = policies; - policyHandlers.put(new QName("http://test","EncryptionPolicy"), - new EncryptionPolicyHandler()); - } - - public Message invoke(Message msg) { - try { - Object[] args = msg.getBody(); - - applyPolicies(args); - - // echo back the first parameter, a real binding would invoke some API for flowing the request - Object result = args[0]; - - msg.setBody(result); - - } catch (Exception e) { - msg.setFaultBody(e); - } - return msg; - } - - private void applyPolicies(Object[] args) throws Exception { - for ( PolicySet policySet : policies ) { - PolicyHandler policyHandler = policyHandlers.get(policySet.getName()); - policyHandler.applyPolicy(args, policySet); - } - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java deleted file mode 100644 index ba74d8f99a..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.provider; - -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.BindingProviderFactory; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -import echo.EchoBinding; - - -/** - * Implementation of the Echo binding model. - */ -public class EchoBindingProviderFactory implements BindingProviderFactory { - - private MessageFactory messageFactory; - - public EchoBindingProviderFactory(ExtensionPointRegistry extensionPoints) { - ModelFactoryExtensionPoint factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - this.messageFactory = factories.getFactory(MessageFactory.class); - } - - public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EchoBinding binding) { - return new EchoReferenceBindingProvider(component, reference, binding); - } - - public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, EchoBinding binding) { - return new EchoServiceBindingProvider(component, service, binding, messageFactory); - } - - public Class getModelType() { - return EchoBinding.class; - } -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java deleted file mode 100644 index 0efc319af9..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.provider; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.policy.PolicySetAttachPoint; -import org.apache.tuscany.sca.provider.ReferenceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; - -import echo.EchoBinding; - -/** - * Implementation of the Echo binding provider. - */ -class EchoReferenceBindingProvider implements ReferenceBindingProvider { - - private RuntimeComponentReference reference; - private EchoBinding binding; - - EchoReferenceBindingProvider(RuntimeComponent component, - RuntimeComponentReference reference, - EchoBinding binding) { - this.reference = reference; - this.binding = binding; - } - - public Invoker createInvoker(Operation operation) { - if (binding instanceof PolicySetAttachPoint) { - PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)binding; - if ( !policySetAttachPoint.getPolicySets().isEmpty() ){ - return new EchoBindingPoliciedInvoker(policySetAttachPoint.getPolicySets()); - } - } - return new EchoBindingInvoker(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public InterfaceContract getBindingInterfaceContract() { - return reference.getInterfaceContract(); - } - - public void start() { - } - - public void stop() { - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java deleted file mode 100644 index 1cd1e5af4e..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.provider; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.invocation.InvocationChain; -import org.apache.tuscany.sca.invocation.MessageFactory; -import org.apache.tuscany.sca.provider.ServiceBindingProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.apache.tuscany.sca.runtime.RuntimeWire; - -import echo.EchoBinding; -import echo.server.EchoServer; -import echo.server.EchoServiceListener; - -/** - * Implementation of the Echo binding provider. - */ -class EchoServiceBindingProvider implements ServiceBindingProvider { - - private RuntimeComponent component; - private RuntimeComponentService service; - private EchoBinding binding; - private MessageFactory messageFactory; - - EchoServiceBindingProvider(RuntimeComponent component, - RuntimeComponentService service, EchoBinding binding, MessageFactory messageFactory) { - this.component = component; - this.service = service; - this.binding = binding; - this.messageFactory = messageFactory; - } - - public InterfaceContract getBindingInterfaceContract() { - return service.getInterfaceContract(); - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - - RuntimeComponentService componentService = (RuntimeComponentService) service; - RuntimeWire wire = componentService.getRuntimeWire(binding); - InvocationChain chain = wire.getInvocationChains().get(0); - - // Register with the hosting server - String uri = binding.getURI(); - EchoServer.getServer().register(uri, new EchoServiceListener(chain.getHeadInvoker(), messageFactory)); - } - - public void stop() { - - // Unregister from the hosting server - String uri = component.getURI() + "/" + binding.getName(); - EchoServer.getServer().unregister(uri); - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java deleted file mode 100644 index 33dc761aa4..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -/** - */ -public class EchoBindingEncryptionPolicy extends EchoBindingPolicy { - - private String encryptionStrategyClassName; - private Class strategyClass; - - public String getEncryptionStrategyClassName() { - return encryptionStrategyClassName; - } - public void setEncryptionStrategyClassName(String encryptionStrategyClassName) { - this.encryptionStrategyClassName = encryptionStrategyClassName; - } - public Class getStrategyClass() { - return strategyClass; - } - public void setStrategyClass(Class strategy) { - this.strategyClass = strategy; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java deleted file mode 100644 index c847d088a6..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; - - -/** - * - */ -public class EchoBindingEncryptionPolicyProcessor extends EchoBindingPolicyProcessor { - - public EchoBindingEncryptionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - } - - public Class getModelType() { - return EchoBindingEncryptionPolicy.class; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java deleted file mode 100644 index 7d38e3b7a8..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.Policy; - -/** - - */ -public class EchoBindingPolicy implements Policy { - private boolean unresolved = true; - - public QName getSchemaName() { - return new QName("http://sample/policy","echoBindingPolicy"); - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java deleted file mode 100644 index 72b8002238..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; - -/** - * - */ -public abstract class EchoBindingPolicyProcessor implements StAXArtifactProcessor { - public static final String ENCRYPTION = "Encryption"; - - public QName getArtifactType() { - return new QName("http://sample/policy", "echoBindingPolicy"); - } - - public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - String name = reader.getAttributeValue(null, "name"); - if (name != null && name.equals(ENCRYPTION)) { - EchoBindingEncryptionPolicy policy = new EchoBindingEncryptionPolicy(); - policy.setEncryptionStrategyClassName(reader.getAttributeValue(null, "strategy")); - return (T)policy; - } - return null; - } - - public void write(T arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException { - } - - public void resolve(T policy, ModelResolver resolver) throws ContributionResolveException { - if (policy instanceof EchoBindingEncryptionPolicy) { - EchoBindingEncryptionPolicy ePolicy = (EchoBindingEncryptionPolicy)policy; - - ClassReference classReference = new ClassReference(ePolicy.getEncryptionStrategyClassName()); - classReference = resolver.resolveModel(ClassReference.class, classReference); - Class javaClass = classReference != null ? classReference.getJavaClass() : null; - if (javaClass == null) { - //throw new ContributionResolveException(new ClassNotFoundException(ePolicy.getEncryptionStrategyClass())); - } - //ePolicy.setStrategyClass(javaClass); - //FIXME: need to resolve this thro resolver - try { - ePolicy.setStrategyClass((Class)Class.forName(ePolicy - .getEncryptionStrategyClassName())); - } catch (Exception e) { - throw new ContributionResolveException(e); - } - ePolicy.setStrategyClass(ePolicy.getStrategyClass()); - ePolicy.setUnresolved(false); - } - } -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java deleted file mode 100644 index deda8d9744..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import org.apache.tuscany.sca.policy.Policy; -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Sample policy handler - */ -public class EncryptionPolicyHandler implements PolicyHandler { - - public void applyPolicy(Object msg, PolicySet policySet) throws Exception { - for ( Object aPolicy : policySet.getPolicies() ) { - if ( aPolicy instanceof EchoBindingEncryptionPolicy ) { - encrypt(msg, (EchoBindingEncryptionPolicy)aPolicy); - } - } - } - - private void encrypt(Object msg, EchoBindingEncryptionPolicy policy) throws Exception { - if ( !policy.isUnresolved() && msg instanceof Object[] ) { - EncryptionStrategy strategy = policy.getStrategyClass().newInstance(); - Object[] msgArgs = (Object[])msg; - for ( int count = 0 ; count < msgArgs.length ; ++count ) { - msgArgs[count] = strategy.encryptMessage(msgArgs[count]); - } - } - - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java deleted file mode 100644 index ffadfc7fff..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -/** - - */ -public interface EncryptionStrategy { - Object encryptMessage(Object msg); -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java deleted file mode 100644 index 6fa5f26977..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import org.apache.tuscany.sca.policy.PolicySet; - -/** - * Sample Policy Handler Interface - * - */ -public interface PolicyHandler { - void applyPolicy(Object msg, PolicySet policySet) throws Exception; -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java deleted file mode 100644 index cf55b36fc2..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -/** - */ -public class ReverseEncryptionStrategy implements EncryptionStrategy { - - public Object encryptMessage(Object msg) { - if ( msg instanceof String ) { - StringBuffer sb = new StringBuffer((String)msg); - msg = sb.reverse().toString(); - } - return msg; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java deleted file mode 100644 index ac610cfb51..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.Policy; - -/** - - */ -public class WSPolicy implements Policy { - private boolean unresolved = true; - - public QName getSchemaName() { - return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment"); - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java deleted file mode 100644 index fcb250b444..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.provider.policy; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; - -public class WSPolicyProcessor implements StAXArtifactProcessor { - - public QName getArtifactType() { - return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment"); - } - - public WSPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - //FIXME Implement this method - return new WSPolicy(); - } - - public void write(WSPolicy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - //FIXME Implement this method - } - - public Class getModelType() { - return WSPolicy.class; - } - - public void resolve(WSPolicy wsPolicy, ModelResolver modelResolver) throws ContributionResolveException { - - } -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java deleted file mode 100644 index 8ea2395d04..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo.server; - -import java.lang.reflect.InvocationTargetException; -import java.util.HashMap; -import java.util.Map; - -/** - * A sample Echo server, showing how to integrate service bindings. - */ -public class EchoServer { - - public static EchoServer server; - - private Map services = new HashMap(); - - public static void start() { - } - - public static void stop() { - } - - public static EchoServer getServer() { - if (server == null) - server = new EchoServer(); - return server; - } - - /** - * Register a service under the given name. - * - * @param service - * @param name - */ - public void register(String uri, EchoServiceListener service) { - if (services.isEmpty()) { - start(); - } - services.put(uri, service); - } - - public void unregister(String uri) { - services.remove(uri); - if (services.isEmpty()) { - stop(); - } - } - - /** - * Dispatch an incoming interaction to the corresponding service. - * - * @param uri - * @param input - * @return - */ - public String sendReceive(String uri, String input) throws InvocationTargetException { - return services.get(uri).sendReceive(input); - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java deleted file mode 100644 index 32336dd94f..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo.server; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.invocation.MessageFactory; - -public class EchoServiceListener { - private Invoker invoker; - private MessageFactory messageFactory; - - public EchoServiceListener(Invoker invoker, MessageFactory messageFactory) { - super(); - this.invoker = invoker; - this.messageFactory = messageFactory; - } - - public String sendReceive(String input) throws InvocationTargetException { - - // Create a request message - Message request = messageFactory.createMessage(); - request.setBody(new Object[] {input}); - - // Dispatch and get the response - Message response = invoker.invoke(request); - Object body = response.getBody(); - if (response.isFault()) { - throw new InvocationTargetException((Throwable)body); - } - return (String)body; - } - -} diff --git a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory deleted file mode 100644 index 55be293862..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the binding model factory -echo.impl.EchoBindingFactoryImpl diff --git a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 06d53250c1..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://echo#binding.echo,model=echo.EchoBinding,factory=echo.EchoBindingFactory -echo.provider.policy.EchoBindingEncryptionPolicyProcessor;qname=http://sample/policy#echoBindingPolicy,model=echo.provider.policy.EchoBindingEncryptionPolicy -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#PolicyAttachment,model=echo.provider.policy.WSPolicy diff --git a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema deleted file mode 100644 index 4ad61f573d..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# URI of the XML schema to be used for validation -sample-binding-echo.xsd diff --git a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index efa475ef92..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the binding provider extension -echo.provider.EchoBindingProviderFactory;model=echo.EchoBinding diff --git a/java/sca/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/java/sca/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd deleted file mode 100644 index 9b64df4871..0000000000 --- a/java/sca/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-echo-extension/src/test/java/echo/Echo.java b/java/sca/samples/binding-echo-extension/src/test/java/echo/Echo.java deleted file mode 100644 index 1d5e973f33..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/java/echo/Echo.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -/** - * Interface of our sample Echo service. - * - * @version $Rev$ $Date$ - */ -public interface Echo { - - String echo(String msg); -} diff --git a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java deleted file mode 100644 index 01b89101a8..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Reference; - - -/** - * A simple client component that uses a reference with an Echo binding. - * - * @version $Rev$ $Date$ - */ -public class EchoComponentImpl implements Echo { - - private Echo echoReference; - - @Constructor - public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) { - this.echoReference = echoReference; - } - - public String echo(String msg) { - String result = echoReference.echo(msg); - System.out.println("Returned message: "+ result); - return result; - } -} diff --git a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java deleted file mode 100644 index 7383077f18..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * @version $Rev$ $Date$ - */ -public class EchoReferenceTestCase extends TestCase { - - private SCADomain scaDomain; - private Echo service; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("EchoBinding.composite"); - service = scaDomain.getService(Echo.class, "EchoComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testEchoBinding() { - String result = service.echo("foo"); - assertEquals(result, "oof"); - } - - -} diff --git a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java deleted file mode 100644 index ab05516622..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import echo.server.EchoServer; - -/** - * @version $Rev$ $Date$ - */ -public class EchoServiceTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("EchoBinding.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testEchoBinding() throws Exception { - String result = EchoServer.getServer().sendReceive("http://tempuri.org", "foo"); - assertEquals(result, "oof"); - } - - -} diff --git a/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite deleted file mode 100644 index 176d67cc4b..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/resources/EchoBinding.composite +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml b/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml deleted file mode 100644 index 1cb1d1c9ba..0000000000 --- a/java/sca/samples/binding-echo-extension/src/test/resources/definitions.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - Communitcation thro this binding must prevent - unauthorized users from reading the messages. - - - \ No newline at end of file diff --git a/java/sca/samples/binding-echo/README b/java/sca/samples/binding-echo/README deleted file mode 100644 index 2772460cc6..0000000000 --- a/java/sca/samples/binding-echo/README +++ /dev/null @@ -1,104 +0,0 @@ -Binding Echo Sample Application -=============================== -This sample demonstrates how to use the new binding extension -binding-echo-extension. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens, open a command prompt, -navigate to this sample directory, and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-binding-echo.jar echo.EchoBindingClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-binding-echo.jar echo.EchoBindingClient - -This looks like a long command. The three things we add to the classpath are - -tuscany-sca-manifest.jar - all of the standard Tuscany SCA runtime and - extension classes -sample-binding-echo-extension.jar - the new echo binding extension implementation -sample-binding-echo - the application that uses the echo binding - -Note: this sample currently is not working on Linux - -Sample Overview ---------------- -This sample contains an application (client and server code) that uses -an SCA binding that simply echoes back any messages that are sent to it. - -binding-echo/ - src/ - main/ - java/ - echo/ - Echo.java - interface definition for the sample - reference and service - EchoComponentImpl.java - sample component implementation with - echo binding reference - EchoBindingClient.java - sample client - resources/ - EchoBinding.composite - the SCA assembly for this sample - test/ - java/ - echo - EchoBindingTestCase.java - sample JUnit test case for the sample - client - binding-echo.png - pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows. - -cd binding-echo -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Passing thro invoker... - [java] Returned message: foo - [java] Echo reference = foo - [java] Passing thro invoker... - [java] Returned message: bar - [java] Echo service = bar - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and -run using Maven as follows. - -cd binding-echo -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running echo.EchoBindingTestCase -Passing thro invoker... -Returned message: foo -Passing thro invoker... -Returned message: bar -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.811 sec - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/binding-echo/binding-echo.png b/java/sca/samples/binding-echo/binding-echo.png deleted file mode 100644 index a38d985363..0000000000 Binary files a/java/sca/samples/binding-echo/binding-echo.png and /dev/null differ diff --git a/java/sca/samples/binding-echo/binding-echo.svg b/java/sca/samples/binding-echo/binding-echo.svg deleted file mode 100644 index 5b5051bef5..0000000000 --- a/java/sca/samples/binding-echo/binding-echo.svg +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - EchoBinding - - - EchoComponent - - - - EchoSerivce EchoReference - - - diff --git a/java/sca/samples/binding-echo/build.xml b/java/sca/samples/binding-echo/build.xml deleted file mode 100644 index 7689ef3a54..0000000000 --- a/java/sca/samples/binding-echo/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-echo/pom.xml b/java/sca/samples/binding-echo/pom.xml deleted file mode 100644 index f5e2464563..0000000000 --- a/java/sca/samples/binding-echo/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-binding-echo - Apache Tuscany SCA Echo Binding Sample Application - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - sample-binding-echo-extension - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/binding-echo/src/main/java/echo/Echo.java b/java/sca/samples/binding-echo/src/main/java/echo/Echo.java deleted file mode 100644 index 1d5e973f33..0000000000 --- a/java/sca/samples/binding-echo/src/main/java/echo/Echo.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -/** - * Interface of our sample Echo service. - * - * @version $Rev$ $Date$ - */ -public interface Echo { - - String echo(String msg); -} diff --git a/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingClient.java b/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingClient.java deleted file mode 100644 index 21bdff4011..0000000000 --- a/java/sca/samples/binding-echo/src/main/java/echo/EchoBindingClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import echo.server.EchoServer; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - * @version $Rev$ $Date$ - */ -public class EchoBindingClient { - - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("EchoBinding.composite"); - - // Call the echo service component which will, in turn, call a reference - // with an echo binding. The echo binding will echo the given string. - Echo service = scaDomain.getService(Echo.class, "EchoComponent"); - String echoString = service.echo("foo"); - System.out.println("Echo reference = " + echoString ); - - // Call the echo server. This will dispatch the call to a service with an - // echo binding. The echo binding will pass the call to the echo component. - echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar"); - System.out.println("Echo service = " + echoString ); - - scaDomain.close(); - - } - -} diff --git a/java/sca/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java b/java/sca/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java deleted file mode 100644 index 01b89101a8..0000000000 --- a/java/sca/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package echo; - -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Reference; - - -/** - * A simple client component that uses a reference with an Echo binding. - * - * @version $Rev$ $Date$ - */ -public class EchoComponentImpl implements Echo { - - private Echo echoReference; - - @Constructor - public EchoComponentImpl(@Reference(name = "echoReference", required = true) Echo echoReference) { - this.echoReference = echoReference; - } - - public String echo(String msg) { - String result = echoReference.echo(msg); - System.out.println("Returned message: "+ result); - return result; - } -} diff --git a/java/sca/samples/binding-echo/src/main/resources/EchoBinding.composite b/java/sca/samples/binding-echo/src/main/resources/EchoBinding.composite deleted file mode 100644 index 94612fb325..0000000000 --- a/java/sca/samples/binding-echo/src/main/resources/EchoBinding.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java b/java/sca/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java deleted file mode 100644 index 1a597fc80f..0000000000 --- a/java/sca/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package echo; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import echo.Echo; -import echo.server.EchoServer; - -public class EchoBindingTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("EchoBinding.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testReference() throws Exception { - // Call the echo service component which will, in turn, call a reference - // with an echo binding. The echo binding will echo the given string. - Echo service = scaDomain.getService(Echo.class, "EchoComponent"); - String echoString = service.echo("foo"); - assertEquals(echoString, "foo"); - } - - public void testService() throws Exception { - // Call the echo server. This will dispatch the call to a service with an - // echo binding. The echo binding will pass the call to the echo component. - String echoString = EchoServer.getServer().sendReceive("http://tempuri.org", "bar"); - assertEquals(echoString, "bar"); - } -} diff --git a/java/sca/samples/binding-notification-broker/README b/java/sca/samples/binding-notification-broker/README deleted file mode 100644 index ebd8bbec30..0000000000 --- a/java/sca/samples/binding-notification-broker/README +++ /dev/null @@ -1,112 +0,0 @@ -Notification Broker Binding Sample -================================== - -This sample illustrates the use of with a -broker. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -Sample Overview ---------------- - -This sample illustrates the use of a notification broker that is located in a -separate (and remote) composite with respect to any producers or consumers. As -such, this sample is run in conjunction with the binding-notification-producer -sample, the binding-notification-consumer sample, or both. Take a look at the -composite file or the .svg file which shows the composite file in pictorial form. -The composite service and composite reference each have a -that handles the remote communication. This binding includes an 'ntm' attribute -that refers to the notification type manager, which manages the connectivity of -producers, consumers and brokers, and which (for this sample) is assumed to be -running on http://localhost:8083. The ntm is a system component that is included in -and runs as part of the binding-notification module. -This sample also illustrates the use of a wsdl interface in the notification -component's . This allows messages sent and received -via to be transported as literal xml over http. - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd binding-notification-broker -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory - [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory - [java] Sep 14, 2007 11:14:24 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory - -Building And Running The Sample Using Maven -------------------------------------------- - -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd binding-notification-broker -mvn - -Sample Usage ------------- - -This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and - -on Wondows, use following command: - -java -Dnotification.httpPort=8080 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-broker.jar notification.broker.TrafficAdvisoryServer - -on *nix, use following command: - -java -Dnotification.httpPort=8080 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-broker.jar notification.broker.TrafficAdvisoryServer - -this should bring up the following prompt: - -Send a report value, ^C or to end - -at this point you should be able to type a message to send, for instance: - -Traffic congestion - -Notice that before you try to receive any message, you should bring up the -consumer sample or another broker sample. When you have finished using this -sample, type 'end' or ^C to end. - -Also notice that '-Dnotification.httpPort=8080' is used in the java command. -This indicates the port the sample should use. This also says that this server -is not going to play the role of ntm, given our previous assumption. It is important -that the first one of the producer, consumer or broker sample that is run be the -one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk -to and an exception will be thrown. - -Sample directory structure: ---------------------------- - -binding-notification-broker/ - src/ - main/ - java/ - notification.broker/ - TestCaseProducer.java - interface for the producer component - TrafficAdvisory.java - remote interface referred to by the producer component - and for the consumer component - TrafficAdvisoryConsumer.java - implementation for the consumer components - TrafficAdvisoryProducer.java - implementation for the producer component - TrafficAdvisoryServer.java - server class including main entry point - resources/ - wsdl/ - TrafficAdvisory.wsdl - remote interface for the notification component - TrafficAdvisoryNotification.componentType - the component type referred to by - - TrafficAdvisoryNotification.composite - the main composite including producer, consumer and - notification components, and composite service and reference - binding-notification-broker.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file diff --git a/java/sca/samples/binding-notification-broker/binding-notification-broker.png b/java/sca/samples/binding-notification-broker/binding-notification-broker.png deleted file mode 100644 index 49030650f2..0000000000 Binary files a/java/sca/samples/binding-notification-broker/binding-notification-broker.png and /dev/null differ diff --git a/java/sca/samples/binding-notification-broker/build.xml b/java/sca/samples/binding-notification-broker/build.xml deleted file mode 100644 index a042b9036a..0000000000 --- a/java/sca/samples/binding-notification-broker/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-broker/pom.xml b/java/sca/samples/binding-notification-broker/pom.xml deleted file mode 100644 index 82e79c24f5..0000000000 --- a/java/sca/samples/binding-notification-broker/pom.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-binding-notification-broker - Apache Tuscany SCA Notification Binding Broker Sample - 2.0-SNAPSHOT - A sample illustrating use of binding.notification - - - - org.apache.tuscany.sca - tuscany-implementation-notification - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-binding-notification - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-databinding - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-interface-wsdl - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - install - - diff --git a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java b/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java deleted file mode 100644 index 35fa1a9ee9..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TestCaseProducer.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.broker; - -public interface TestCaseProducer { - - public void produceTrafficNotification(String report); -} diff --git a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java b/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java deleted file mode 100644 index 3f069ede78..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisory.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.broker; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@Remotable -public interface TrafficAdvisory { - - void trafficNotification(String report); -} diff --git a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java b/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java deleted file mode 100644 index b9a5b98126..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryConsumer.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.broker; - -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(TrafficAdvisory.class) -@Scope("COMPOSITE") -@AllowsPassByReference -public class TrafficAdvisoryConsumer implements TrafficAdvisory { - - @Property - protected String name; - - public void trafficNotification(String report) { - - System.out.println("Consumer [" + name + "] received report: " + report); - } -} diff --git a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java b/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java deleted file mode 100644 index 6406572d10..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryProducer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.broker; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -@Service(TestCaseProducer.class) -@Scope("COMPOSITE") -public class TrafficAdvisoryProducer implements TestCaseProducer { - - @Reference - protected TrafficAdvisory destination; - - public void produceTrafficNotification(String report) { - - destination.trafficNotification(report); - } -} diff --git a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java b/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java deleted file mode 100644 index b0f0d2a800..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/java/notification/broker/TrafficAdvisoryServer.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.broker; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URI; - -import org.apache.tuscany.sca.binding.notification.NotificationBindingProviderFactory; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * @version $Rev$ $Date$ - */ -public class TrafficAdvisoryServer { - - private static URI notificationType; - - public static void main(String[] args) { - try { - notificationType = new URI("trafficAdvisory"); - String compositeName = "TrafficAdvisoryNotification.composite"; - SCADomain domain = SCADomain.newInstance(compositeName); - TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); - - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - String value = ""; - if (args.length == 1) { - value = args[0]; - } - do { - if(value == null || value.equals("end")) { - break; - } - try { - System.out.println("Send a report value, ^C or to end"); - value = reader.readLine(); - } catch (IOException e) { - e.printStackTrace(); - } - if (value.equals("rb")) { - NotificationBindingProviderFactory.removeBroker(notificationType); - } - else { - testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); - } - } - while(true); - - domain.close(); - } catch(Throwable e) { - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType deleted file mode 100644 index 2dc70f8ed1..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.componentType +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite deleted file mode 100644 index f490c34ea6..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/resources/TrafficAdvisoryNotification.composite +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Consumer1 - - - - - - - - - diff --git a/java/sca/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl deleted file mode 100644 index b823bbebcc..0000000000 --- a/java/sca/samples/binding-notification-broker/src/main/resources/wsdl/TrafficAdvisory.wsdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-consumer/README b/java/sca/samples/binding-notification-consumer/README deleted file mode 100644 index b54b445670..0000000000 --- a/java/sca/samples/binding-notification-consumer/README +++ /dev/null @@ -1,109 +0,0 @@ -Notification Consumer Binding Sample -=============================== - -This sample illustrates the use of with a -remote consumer. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -Sample Overview ---------------- - -This sample illustrates the use of a notification consumer that is located in a -separate (and remote) composite with respect to any producers. As such, this sample -is run in conjunction with the binding-notification-producer sample, the -binding-notification-broker sample, or both. Take a look at the composite file -or the .svg file which shows the composite file in pictorial form. The composite -service, wired to the notification component, has a -that handles the remote communication. This binding includes an 'ntm' attribute -that refers to the notification type manager, which manages the connectivity of -producers, consumers and brokers, and which (for this sample) is assumed to be -running on http://localhost:8083. The ntm is a system component that is included in -and runs as part of the binding-notification module. -This sample also illustrates the use of a wsdl interface in the notification -component's . This allows messages sent and received -via to be transported as literal xml over http. - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd binding-notification-consumer -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory - [java] Sep 14, 2007 10:56:29 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/consumer/trafficAdvisory - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd binding-notification-consumer -mvn - -Sample Usage ------------- - -This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and - -on Wondows, use following command: - -java -Dnotification.httpPort=8082 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-consumer.jar notification.consumer.TrafficAdvisoryServer - -on *nix, use following command: - -java -Dnotification.httpPort=8082 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-consumer.jar notification.consumer.TrafficAdvisoryServer - -this should bring up the following prompt: - -TrafficAdvisoryServer, hit return to end - -at this point you should be able to receive messages. - -Notice that before you try to receive any message, you should bring up the -producer sample or the broker sample. When you have finished using this -sample, hit return to end. - -Also notice that '-Dnotification.httpPort=8082' is used in the java command. -This indicates the port the sample should use. This also says that this server -is not going to play the role of ntm, given our previous assumption. It is important -that the first one of the producer, consumer or broker sample that is run be the -one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk -to and an exception will be thrown. - -Sample directory structure: ---------------------------- - -binding-notification-consumer/ - src/ - main/ - java/ - notification.consumer/ - TrafficAdvisory.java - remote interface referred to by the producer component - TrafficAdvisoryConsumer.java - implementation for the consumer components - TrafficAdvisoryServer.java - server class including main entry point - resources/ - wsdl/ - TrafficAdvisory.wsdl - remote interface for the notification component - TrafficAdvisoryNotification.componentType - the component type referred to by - - TrafficAdvisoryNotification.composite - the main composite including producer and - notification components, and composite reference - test/ - java/ - notification.producer/ - TrafficAdvisoryTestCase.java - JUnit test case - resources/ - binding-notification-consumer.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file diff --git a/java/sca/samples/binding-notification-consumer/binding-notification-consumer.png b/java/sca/samples/binding-notification-consumer/binding-notification-consumer.png deleted file mode 100644 index 33e1966c3e..0000000000 Binary files a/java/sca/samples/binding-notification-consumer/binding-notification-consumer.png and /dev/null differ diff --git a/java/sca/samples/binding-notification-consumer/build.xml b/java/sca/samples/binding-notification-consumer/build.xml deleted file mode 100644 index f57fe1bb26..0000000000 --- a/java/sca/samples/binding-notification-consumer/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-consumer/pom.xml b/java/sca/samples/binding-notification-consumer/pom.xml deleted file mode 100644 index c1452f7d02..0000000000 --- a/java/sca/samples/binding-notification-consumer/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-binding-notification-consumer - Apache Tuscany SCA Notification Binding Consumer Sample - 2.0-SNAPSHOT - A sample illustrating use of binding.notification - - - - org.apache.tuscany.sca - tuscany-implementation-notification - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-notification - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - notification.httpPort - 8083 - - - - - - install - - diff --git a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java b/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java deleted file mode 100644 index 424728692f..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisory.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.consumer; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@Remotable -public interface TrafficAdvisory { - - void trafficNotification(String report); -} diff --git a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java b/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java deleted file mode 100644 index 852ddaa919..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryConsumer.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.consumer; - -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(TrafficAdvisory.class) -@Scope("COMPOSITE") -@AllowsPassByReference -public class TrafficAdvisoryConsumer implements TrafficAdvisory { - - @Property - protected String name; - - public void trafficNotification(String report) { - - System.out.println("Consumer [" + name + "] received report: " + report); - } -} diff --git a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java b/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java deleted file mode 100644 index c53adb1944..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/java/notification/consumer/TrafficAdvisoryServer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.consumer; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * @version $Rev$ $Date$ - */ -public class TrafficAdvisoryServer { - - public static void main(String[] args) { - try { - SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - - try { - if (args.length != 1 || !args[0].equals("end")) { - System.out.println("TrafficAdvisoryServer, hit return to end"); - System.in.read(); - } - } catch (IOException e) { - e.printStackTrace(); - } - - domain.close(); - } catch(Throwable e) { - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType deleted file mode 100644 index 2dc70f8ed1..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.componentType +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite deleted file mode 100644 index 8f9bcc4438..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/resources/TrafficAdvisoryNotification.composite +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - Consumer1 - - - - - Consumer2 - - - diff --git a/java/sca/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl deleted file mode 100644 index b823bbebcc..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/main/resources/wsdl/TrafficAdvisory.wsdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java b/java/sca/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java deleted file mode 100644 index c5318f405c..0000000000 --- a/java/sca/samples/binding-notification-consumer/src/test/java/notification/consumer/TrafficAdvisoryTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.consumer; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import junit.framework.TestCase; - -public class TrafficAdvisoryTestCase extends TestCase { - - private SCADomain domain; - - public void testTrafficAdvisoryNotification() throws Exception { - System.out.println("Only instantiating and closing domain ..."); - - /* Uncomment to test with producer - try { - System.out.println("TrafficAdvisoryServer, hit return to end"); - System.in.read(); - } catch (Exception e) { - e.printStackTrace(); - } - */ - } - - @Override - protected void setUp() throws Exception { - try { - domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - } catch(Throwable e) { - e.printStackTrace(); - if (e instanceof Exception) { - throw (Exception)e; - } - else { - throw new Exception(e); - } - } - } - - @Override - protected void tearDown() throws Exception { - domain.close(); - } -} diff --git a/java/sca/samples/binding-notification-producer/README b/java/sca/samples/binding-notification-producer/README deleted file mode 100644 index c5f284d4c5..0000000000 --- a/java/sca/samples/binding-notification-producer/README +++ /dev/null @@ -1,133 +0,0 @@ -Notification Producer Binding Sample -=============================== - -This sample illustrates the use of with a -remote producer. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -Sample Overview ---------------- - -This sample illustrates the use of a notification producer that is located in a -separate (and remote) composite with respect to any consumers. As such, this sample -is run in conjunction with the binding-notification-consumer sample, the -binding-notification-broker sample, or both. Take a look at the composite file -or the .svg file which shows the composite file in pictorial form. The composite -reference, referred to by the notification component, has a -that handles the remote communication. This binding includes an 'ntm' attribute -that refers to the notification type manager, which manages the connectivity of -producers, consumers and brokers, and which (for this sample) is assumed to be -running on http://localhost:8083. The ntm is a system component that is included in -and runs as part of the binding-notification module. -This sample also illustrates the use of a wsdl interface in the notification -component's . This allows messages sent and received -via to be transported as literal xml over http. - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd binding-notification-producer -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory - [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd binding-notification-producer -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running notification.producer.TrafficAdvisoryTestCase -Only instantiating and closing domain ... -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.252 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. - -Sample Usage ------------- - -This sample is run using the tuscany binary distribution. To run it, navigate to this sample's directory and - -on Wondows, use following command: - -java -Dnotification.httpPort=8083 -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-binding-notification-producer.jar notification.producer.TrafficAdvisoryServer - -on *nix, use following command: - -java -Dnotification.httpPort=8083 -cp ../../lib/tuscany-sca-manifest.jar:target/sample-binding-notification-producer.jar notification.producer.TrafficAdvisoryServer - -this should bring up the following prompt: - -Send a report value, ^C or to end - -at this point you should be able to type a message to send, for instance: - -Traffic congestion - -Notice that before you try to send any message, you should bring up the -consumer sample or the broker sample. When you have finished using this -sample, type 'end' or ^C to end. - -Also notice that '-Dnotification.httpPort=8083' is used in the java command. -This indicates the port the sample should use. This also says that this server -is going to play the role of ntm, given our previous assumption. It is important -that the first one of the producer, consumer or broker sample that is run be the -one that uses '-Dnotification.httpPort=8083', otherwise there is no ntm to talk -to and an exception will be thrown. - -Sample directory structure: ---------------------------- - -binding-notification-producer/ - src/ - main/ - java/ - notification.producer/ - TestCaseProducer.java - interface for the producer component - TrafficAdvisory.java - remote interface referred to by the producer component - TrafficAdvisoryProducer.java - implementation for the producer component - TrafficAdvisoryServer.java - server class including main entry point - resources/ - wsdl/ - TrafficAdvisory.wsdl - remote interface for the notification component - TrafficAdvisoryNotification.componentType - the component type referred to by - - TrafficAdvisoryNotification.composite - the main composite including producer and - notification components, and composite reference - test/ - java/ - notification.producer/ - TrafficAdvisoryTestCase.java - JUnit test case - resources/ - wsdl/ - TrafficAdvisory.wsdl - remote interface for the notification component - TrafficAdvisoryNotification.componentType - the component type referred to by - - TrafficAdvisoryNotification.composite - the main composite including producer and - notification components, and composite reference - binding-notification-producer.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file diff --git a/java/sca/samples/binding-notification-producer/binding-notification-producer.png b/java/sca/samples/binding-notification-producer/binding-notification-producer.png deleted file mode 100644 index 34c347c893..0000000000 Binary files a/java/sca/samples/binding-notification-producer/binding-notification-producer.png and /dev/null differ diff --git a/java/sca/samples/binding-notification-producer/build.xml b/java/sca/samples/binding-notification-producer/build.xml deleted file mode 100644 index d13e4c8a6c..0000000000 --- a/java/sca/samples/binding-notification-producer/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-producer/pom.xml b/java/sca/samples/binding-notification-producer/pom.xml deleted file mode 100644 index ffe90c0cb3..0000000000 --- a/java/sca/samples/binding-notification-producer/pom.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-binding-notification-producer - Apache Tuscany SCA Notification Binding Producer Sample - 2.0-SNAPSHOT - A sample illustrating use of binding.notification - - - - org.apache.tuscany.sca - tuscany-implementation-notification - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-notification - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 2.0-SNAPSHOT - runtime - - - - javax.servlet - servlet-api - 2.5 - provided - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins - maven-jar-plugin - - - - org.apache.tuscany.notification.remoteProducer.TrafficAdvisoryServer - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - - notification.httpPort - 8083 - - - - - - install - - diff --git a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java b/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java deleted file mode 100644 index be80e71249..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TestCaseProducer.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.producer; - -public interface TestCaseProducer { - - public void produceTrafficNotification(String report); -} diff --git a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java b/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java deleted file mode 100644 index 548d45b12d..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisory.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.producer; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@Remotable -public interface TrafficAdvisory { - - void trafficNotification(String report); -} diff --git a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java b/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java deleted file mode 100644 index e670ccb95c..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryProducer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.producer; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -@Service(TestCaseProducer.class) -@Scope("COMPOSITE") -public class TrafficAdvisoryProducer implements TestCaseProducer { - - @Reference - protected TrafficAdvisory destination; - - public void produceTrafficNotification(String report) { - - destination.trafficNotification(report); - } -} diff --git a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java b/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java deleted file mode 100644 index efd3657dc3..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.producer; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class TrafficAdvisoryServer { - - public static void main(String[] args) { - try { - SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - String value = ""; - if (args.length == 1) { - value = args[0]; - } - do { - if(value == null || value.equals("end")) { - break; - } - try { - System.out.println("Send a report value, ^C or to end"); - value = reader.readLine(); - } catch (IOException e) { - e.printStackTrace(); - } - testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); - } - while(true); - - domain.close(); - } catch(Throwable e) { - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType deleted file mode 100644 index 2dc70f8ed1..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.componentType +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite deleted file mode 100644 index 2db6ea655b..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/resources/TrafficAdvisoryNotification.composite +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl b/java/sca/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl deleted file mode 100644 index b823bbebcc..0000000000 --- a/java/sca/samples/binding-notification-producer/src/main/resources/wsdl/TrafficAdvisory.wsdl +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java b/java/sca/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java deleted file mode 100644 index d3901ee407..0000000000 --- a/java/sca/samples/binding-notification-producer/src/test/java/notification/producer/TrafficAdvisoryTestCase.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification.producer; - -import java.io.BufferedReader; -import java.io.InputStreamReader; - -import notification.producer.TestCaseProducer; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -//import org.apache.tuscany.sca.notification.remoteProducer.TestCaseProducer; - -import junit.framework.TestCase; - -public class TrafficAdvisoryTestCase extends TestCase { - - private SCADomain domain; - - public void testTrafficAdvisoryNotification() throws Exception { - System.out.println("Only instantiating and closing domain ..."); - TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); - - /* Uncomment to test with consumer - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); - String value = "foo"; - do { - try { - System.out.println("Send a report value, ^C or to end"); - value = reader.readLine(); - } catch (Exception e) { - e.printStackTrace(); - } - if(value == null || value.equals("end")) { - break; - } - testCaseProducer.produceTrafficNotification("Report value [" + value + "]"); - value = "end"; - } - while(true); - */ - } - - @Override - protected void setUp() throws Exception { - try { - domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - } catch(Throwable e) { - e.printStackTrace(); - if (e instanceof Exception) { - throw (Exception)e; - } - else { - throw new Exception(e); - } - } - } - - @Override - protected void tearDown() throws Exception { - domain.close(); - } -} diff --git a/java/sca/samples/calculator-corba-reference/README b/java/sca/samples/calculator-corba-reference/README deleted file mode 100644 index 66c4cddb94..0000000000 --- a/java/sca/samples/calculator-corba-reference/README +++ /dev/null @@ -1,83 +0,0 @@ -Calculator CORBA Reference Sample -=============================== - -This sample illustrates the use of Tuscany CORBA Binding to call reference -services that are hosted as CORBA services. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - - -Sample Overview ---------------- -This sample extends the calculator sample by replacing the local wired -connections with CORBA bindings. Instead of local add, subtract, multiply and -divide components, an CORBA service implementation now provides the -add, subtract, multiply and divide interfaces and is hosted as an CORBA object. -References specified in the .composite file include a CORBA binding which targets -this CORBA object. Name service which is used in CORBA communication is provided -in test case class - CalculatorCORBAReferenceTestCase.java. - -This sample adds a number of classes to the basic calculator sample: - -calculator-corba-reference/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - as calculator sample - AddService.java - as calculator sample - SubtractService.java - as calculator sample - MultipleService.java - as calculator sample - DivideService.java - as calculator sample - CalculatorClient.java - as calculator sample - CalculatorServiceImpl.java - calls the CORBA service - that provides the target for the - CORBA bindings in the composite - resources/ - CalculatorCORBAReference.composite - the SCA assembly for this sample - test/ - java/ - calculator/ - CalculatorCORBAReferenceTestCase.java - JUnit test case - CalculatorCORBAServant.java - CORBA service implementation - idl/ - contains files generated - from IDL file. Files are - used to create CORBA object which - will be consumed by SCA reference. - _CalculatorCORBAServiceImplBase.java - CalculatorCORBAService.java - CalculatorCORBAServiceOperations.java - resources/ - CalculatorCORBA.idl - IDL description for CORBA object - pom.xml - the Maven build file - -Note. As this test creates and uses local network connections you may need to -configure your firewall, if you are running one, to allow the test to run -successfully. - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-corba-reference -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorCORBAReferenceTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.308 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. - - - diff --git a/java/sca/samples/calculator-corba-reference/pom.xml b/java/sca/samples/calculator-corba-reference/pom.xml deleted file mode 100644 index 96d4ce402c..0000000000 --- a/java/sca/samples/calculator-corba-reference/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-corba-reference - Apache Tuscany SCA Calculator CORBA Reference Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-binding-corba-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-host-corba-jse - 2.0-SNAPSHOT - runtime - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/AddService.java deleted file mode 100644 index ec57a6a533..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the add service - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index cd1076c3f1..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("CalculatorRMIReference.composite"); - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - - } - -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 0bac3da45c..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.rmi.Remote; -import java.rmi.RemoteException; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The Calculator service interface. - */ -@Remotable -public interface CalculatorService extends Remote { - - double add(double n1, double n2) throws RemoteException; - - double subtract(double n1, double n2) throws RemoteException; - - double multiply(double n1, double n2) throws RemoteException; - - double divide(double n1, double n2) throws RemoteException; -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 675350860e..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite b/java/sca/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite deleted file mode 100644 index 717add91a8..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/main/resources/CalculatorCORBAReference.composite +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java b/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java deleted file mode 100644 index 041608273b..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAReferenceTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.corba.naming.TransientNameServer; -import org.apache.tuscany.sca.host.corba.naming.TransientNameService; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.omg.CORBA.ORB; -import org.omg.CosNaming.NameComponent; -import org.omg.CosNaming.NamingContext; -import org.omg.CosNaming.NamingContextHelper; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorCORBAReferenceTestCase extends TestCase { - - private SCADomain scaDomain; - private CalculatorService calculatorService; - private TransientNameServer server; - - private void bindObject(String name, org.omg.CORBA.Object object) throws Exception { - ORB orb = server.getORB(); - org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); - NamingContext ncRef = NamingContextHelper.narrow(objRef); - NameComponent nc = new NameComponent(name, ""); - NameComponent path[] = {nc}; - ncRef.rebind(path, object); - } - - @BeforeClass - protected void setUp() throws Exception { - // create name service - server = new TransientNameServer("localhost", 5080, TransientNameService.DEFAULT_SERVICE_NAME); - Thread t = server.start(); - if (t == null) { - Assert.fail("The naming server cannot be started"); - } else { - // create CORBA object which will be accessible by SCA CORBA binding - bindObject("CalculatorCORBAService", new CalculatorCORBAServant()); - scaDomain = SCADomain.newInstance("CalculatorCORBAReference.composite"); - calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - } - } - - @AfterClass - protected void tearDown() throws Exception { - scaDomain.close(); - server.stop(); - } - - @Test - public void testCalculator() throws Exception { - assertEquals(5.0, calculatorService.add(3, 2)); - assertEquals(1.0, calculatorService.subtract(3, 2)); - assertEquals(6.0, calculatorService.multiply(3, 2)); - assertEquals(1.5, calculatorService.divide(3, 2)); - } -} diff --git a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java b/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java deleted file mode 100644 index 65e9b89ce2..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/CalculatorCORBAServant.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import calculator.idl._CalculatorCORBAServiceImplBase; - -public class CalculatorCORBAServant extends _CalculatorCORBAServiceImplBase { - - private static final long serialVersionUID = 1L; - - public double add(double arg1, double arg2) { - return arg1 + arg2; - } - - public double subtract(double arg1, double arg2) { - return arg1 - arg2; - } - - public double multiply(double arg1, double arg2) { - return arg1 * arg2; - } - - public double divide(double arg1, double arg2) { - return arg1 / arg2; - } - -} diff --git a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java b/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java deleted file mode 100644 index 6206e0cf6f..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/CalculatorCORBAService.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST -*/ - -public interface CalculatorCORBAService extends CalculatorCORBAServiceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} // interface CalculatorCORBAService diff --git a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java b/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java deleted file mode 100644 index 6facda6a34..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/CalculatorCORBAServiceOperations.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST -*/ - -public interface CalculatorCORBAServiceOperations -{ - double add (double arg1, double arg2); - double subtract (double arg1, double arg2); - double multiply (double arg1, double arg2); - double divide (double arg1, double arg2); -} // interface CalculatorCORBAServiceOperations diff --git a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java b/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java deleted file mode 100644 index f6a4bd8994..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/java/calculator/idl/_CalculatorCORBAServiceImplBase.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/_CalculatorCORBAServiceImplBase.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 16:02:31 CEST -*/ - -public abstract class _CalculatorCORBAServiceImplBase extends org.omg.CORBA.portable.ObjectImpl - implements calculator.idl.CalculatorCORBAService, org.omg.CORBA.portable.InvokeHandler -{ - - // Constructors - public _CalculatorCORBAServiceImplBase () - { - } - - private static java.util.Hashtable _methods = new java.util.Hashtable (); - static - { - _methods.put ("add", new java.lang.Integer (0)); - _methods.put ("subtract", new java.lang.Integer (1)); - _methods.put ("multiply", new java.lang.Integer (2)); - _methods.put ("divide", new java.lang.Integer (3)); - } - - public org.omg.CORBA.portable.OutputStream _invoke (String $method, - org.omg.CORBA.portable.InputStream in, - org.omg.CORBA.portable.ResponseHandler $rh) - { - org.omg.CORBA.portable.OutputStream out = null; - java.lang.Integer __method = (java.lang.Integer)_methods.get ($method); - if (__method == null) - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - - switch (__method.intValue ()) - { - case 0: // calculator/idl/CalculatorCORBAService/add - { - double arg1 = in.read_double (); - double arg2 = in.read_double (); - double $result = (double)0; - $result = this.add (arg1, arg2); - out = $rh.createReply(); - out.write_double ($result); - break; - } - - case 1: // calculator/idl/CalculatorCORBAService/subtract - { - double arg1 = in.read_double (); - double arg2 = in.read_double (); - double $result = (double)0; - $result = this.subtract (arg1, arg2); - out = $rh.createReply(); - out.write_double ($result); - break; - } - - case 2: // calculator/idl/CalculatorCORBAService/multiply - { - double arg1 = in.read_double (); - double arg2 = in.read_double (); - double $result = (double)0; - $result = this.multiply (arg1, arg2); - out = $rh.createReply(); - out.write_double ($result); - break; - } - - case 3: // calculator/idl/CalculatorCORBAService/divide - { - double arg1 = in.read_double (); - double arg2 = in.read_double (); - double $result = (double)0; - $result = this.divide (arg1, arg2); - out = $rh.createReply(); - out.write_double ($result); - break; - } - - default: - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - - return out; - } // _invoke - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:calculator/idl/CalculatorCORBAService:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - -} // class _CalculatorCORBAServiceImplBase diff --git a/java/sca/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl b/java/sca/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl deleted file mode 100644 index 55ffeac8a3..0000000000 --- a/java/sca/samples/calculator-corba-reference/src/test/resources/CalculatorCORBA.idl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Compile by: idlj -fserver -oldImplBase CalculatorCORBA.idl - */ - -module calculator { - module idl { - interface CalculatorCORBAService { - double add(in double arg1, in double arg2); - double subtract(in double arg1, in double arg2); - double multiply(in double arg1, in double arg2); - double divide(in double arg1, in double arg2); - }; - }; -}; \ No newline at end of file diff --git a/java/sca/samples/calculator-corba-service/README b/java/sca/samples/calculator-corba-service/README deleted file mode 100644 index 87863752cd..0000000000 --- a/java/sca/samples/calculator-corba-service/README +++ /dev/null @@ -1,82 +0,0 @@ -Calculator CORBA Service Sample -============================= - -This sample illustrates the use of Tuscany CORBA Binding to expose component -services as CORBA objects. It also demonstrates how a simple Java CORBA -Client application invokes the SCA Application's services exposed as CORBA -Services. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - - -Sample Overview ---------------- -This sample extends the calculator sample by replacing the local service -binding with an CORBA binding. So a java client can call the service exposed -by the SCA application using an CORBA client. Name service which is used in -CORBA communication is provided by Tuscany CORBA hosting module -(maven dependency: tuscany-host-corba-jse-tns) - see CORBA binding reference -on Apache Tuscany website for details. - -This sample adds a number of classes to the basic calculator sample: - -calculator-corba-service/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - as calculator sample - CalculatorServiceImpl.java - AddService.java - as calculator sample - AddServiceImpl.java - SubtractService.java - as calculator sample - SubtractServiceImpl.java - MultiplyService.java - as calculator sample - MultiplyServiceImpl.java - DivideService.java - as calculator sample - DivideServiceImpl.java - resources/ - CalculatorCORBAServer.composite - the SCA assembly for this sample - test/ - java/ - calculator/ - CalculatorCORBAServerTestCase.java - JUnit test case - idl/ - contains files generated - from IDL file. Files are - used to access SCA component. - CalculatorCORBAServiceHelper.java - CalculatorCORBAService.java - _CalculatorCORBAServiceStub.java - CalculatorCORBAServiceHolder.java - CalculatorCORBAServiceOperations.java - resources/ - CalculatorCORBA.idl - IDL description for SCA component - pom.xml - the Maven build file - -Note. As this test creates and uses local network connections you may need to -configure your firewall, if you are running one, to allow the test to run -successfully. - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-corba-service -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorCORBAServerTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.819 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator-corba-service/pom.xml b/java/sca/samples/calculator-corba-service/pom.xml deleted file mode 100644 index 63c5f5f9a6..0000000000 --- a/java/sca/samples/calculator-corba-service/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-corba-service - Apache Tuscany SCA Calculator CORBA Service Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-binding-corba-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-host-corba-jse-tns - 2.0-SNAPSHOT - runtime - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddService.java deleted file mode 100644 index ec57a6a533..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the add service - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index b0a46b6dd0..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The Calculator service interface. - */ -@Remotable -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 675350860e..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 8c33862f6d..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index c7fbc73c00..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1a7f145ad8..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite b/java/sca/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite deleted file mode 100644 index 1ab6cecef7..0000000000 --- a/java/sca/samples/calculator-corba-service/src/main/resources/CalculatorCORBAServer.composite +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java deleted file mode 100644 index 4248ca8573..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/CalculatorCORBAServerTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.omg.CORBA.ORB; - -import calculator.idl.CalculatorCORBAService; -import calculator.idl.CalculatorCORBAServiceHelper; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorCORBAServerTestCase extends TestCase { - - private SCADomain scaDomain; - private CalculatorCORBAService calculatorService; - - @BeforeClass - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("CalculatorCORBAServer.composite"); - String[] args = {"-ORBInitialPort", "5080"}; - // retrieve CORBA object which is SCA component - ORB orb = ORB.init(args, null); - calculatorService = - CalculatorCORBAServiceHelper.narrow(orb - .string_to_object("corbaname::localhost:5080#CalculatorCORBAService")); - } - - @AfterClass - protected void tearDown() throws Exception { - scaDomain.close(); - } - - @Test - public void testCalculator() throws Exception { - assertEquals(5.0, calculatorService.add(3, 2)); - assertEquals(1.0, calculatorService.subtract(3, 2)); - assertEquals(6.0, calculatorService.multiply(3, 2)); - assertEquals(1.5, calculatorService.divide(3, 2)); - } -} diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java deleted file mode 100644 index 6576358755..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/CalculatorCORBAService.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST -*/ - -public interface CalculatorCORBAService extends CalculatorCORBAServiceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} // interface CalculatorCORBAService diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java deleted file mode 100644 index 0977982fb3..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHelper.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/CalculatorCORBAServiceHelper.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST -*/ - -abstract public class CalculatorCORBAServiceHelper -{ - private static String _id = "IDL:calculator/idl/CalculatorCORBAService:1.0"; - - public static void insert (org.omg.CORBA.Any a, calculator.idl.CalculatorCORBAService that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static calculator.idl.CalculatorCORBAService extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (calculator.idl.CalculatorCORBAServiceHelper.id (), "CalculatorCORBAService"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static calculator.idl.CalculatorCORBAService read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_CalculatorCORBAServiceStub.class)); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, calculator.idl.CalculatorCORBAService value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); - } - - public static calculator.idl.CalculatorCORBAService narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof calculator.idl.CalculatorCORBAService) - return (calculator.idl.CalculatorCORBAService)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - calculator.idl._CalculatorCORBAServiceStub stub = new calculator.idl._CalculatorCORBAServiceStub (); - stub._set_delegate(delegate); - return stub; - } - } - - public static calculator.idl.CalculatorCORBAService unchecked_narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof calculator.idl.CalculatorCORBAService) - return (calculator.idl.CalculatorCORBAService)obj; - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - calculator.idl._CalculatorCORBAServiceStub stub = new calculator.idl._CalculatorCORBAServiceStub (); - stub._set_delegate(delegate); - return stub; - } - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java deleted file mode 100644 index 0cf6439d49..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceHolder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - -/** -* calculator/idl/CalculatorCORBAServiceHolder.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST -*/ - -public final class CalculatorCORBAServiceHolder implements org.omg.CORBA.portable.Streamable -{ - public calculator.idl.CalculatorCORBAService value = null; - - public CalculatorCORBAServiceHolder () - { - } - - public CalculatorCORBAServiceHolder (calculator.idl.CalculatorCORBAService initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = calculator.idl.CalculatorCORBAServiceHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - calculator.idl.CalculatorCORBAServiceHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return calculator.idl.CalculatorCORBAServiceHelper.type (); - } - -} diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java deleted file mode 100644 index 3e2956d469..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/CalculatorCORBAServiceOperations.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/CalculatorCORBAServiceOperations.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST -*/ - -public interface CalculatorCORBAServiceOperations -{ - double add (double arg1, double arg2); - double subtract (double arg1, double arg2); - double multiply (double arg1, double arg2); - double divide (double arg1, double arg2); -} // interface CalculatorCORBAServiceOperations diff --git a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java b/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java deleted file mode 100644 index ad193ee121..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/java/calculator/idl/_CalculatorCORBAServiceStub.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.idl; - - -/** -* calculator/idl/_CalculatorCORBAServiceStub.java . -* Generated by the IDL-to-Java compiler (portable), version "3.2" -* from CalculatorCORBA.idl -* ¶roda, 15 pa¼dziernik 2008 15:59:26 CEST -*/ - -public class _CalculatorCORBAServiceStub extends org.omg.CORBA.portable.ObjectImpl implements calculator.idl.CalculatorCORBAService -{ - - public double add (double arg1, double arg2) - { - org.omg.CORBA.portable.InputStream $in = null; - try { - org.omg.CORBA.portable.OutputStream $out = _request ("add", true); - $out.write_double (arg1); - $out.write_double (arg2); - $in = _invoke ($out); - double $result = $in.read_double (); - return $result; - } catch (org.omg.CORBA.portable.ApplicationException $ex) { - $in = $ex.getInputStream (); - String _id = $ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException $rm) { - return add (arg1, arg2 ); - } finally { - _releaseReply ($in); - } - } // add - - public double subtract (double arg1, double arg2) - { - org.omg.CORBA.portable.InputStream $in = null; - try { - org.omg.CORBA.portable.OutputStream $out = _request ("subtract", true); - $out.write_double (arg1); - $out.write_double (arg2); - $in = _invoke ($out); - double $result = $in.read_double (); - return $result; - } catch (org.omg.CORBA.portable.ApplicationException $ex) { - $in = $ex.getInputStream (); - String _id = $ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException $rm) { - return subtract (arg1, arg2 ); - } finally { - _releaseReply ($in); - } - } // subtract - - public double multiply (double arg1, double arg2) - { - org.omg.CORBA.portable.InputStream $in = null; - try { - org.omg.CORBA.portable.OutputStream $out = _request ("multiply", true); - $out.write_double (arg1); - $out.write_double (arg2); - $in = _invoke ($out); - double $result = $in.read_double (); - return $result; - } catch (org.omg.CORBA.portable.ApplicationException $ex) { - $in = $ex.getInputStream (); - String _id = $ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException $rm) { - return multiply (arg1, arg2 ); - } finally { - _releaseReply ($in); - } - } // multiply - - public double divide (double arg1, double arg2) - { - org.omg.CORBA.portable.InputStream $in = null; - try { - org.omg.CORBA.portable.OutputStream $out = _request ("divide", true); - $out.write_double (arg1); - $out.write_double (arg2); - $in = _invoke ($out); - double $result = $in.read_double (); - return $result; - } catch (org.omg.CORBA.portable.ApplicationException $ex) { - $in = $ex.getInputStream (); - String _id = $ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException $rm) { - return divide (arg1, arg2 ); - } finally { - _releaseReply ($in); - } - } // divide - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:calculator/idl/CalculatorCORBAService:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - private void readObject (java.io.ObjectInputStream s) throws java.io.IOException - { - String str = s.readUTF (); - String[] args = null; - java.util.Properties props = null; - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } - - private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException - { - String[] args = null; - java.util.Properties props = null; - String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this); - s.writeUTF (str); - } -} // class _CalculatorCORBAServiceStub diff --git a/java/sca/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl b/java/sca/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl deleted file mode 100644 index 5848bbaa2c..0000000000 --- a/java/sca/samples/calculator-corba-service/src/test/resources/CalculatorCORBA.idl +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Compile by: idlj -fclient -oldImplBase CalculatorCORBA.idl - */ - -module calculator { - module idl { - interface CalculatorCORBAService { - double add(in double arg1, in double arg2); - double subtract(in double arg1, in double arg2); - double multiply(in double arg1, in double arg2); - double divide(in double arg1, in double arg2); - }; - }; -}; \ No newline at end of file diff --git a/java/sca/samples/calculator-distributed/README b/java/sca/samples/calculator-distributed/README deleted file mode 100644 index 51f4b07e81..0000000000 --- a/java/sca/samples/calculator-distributed/README +++ /dev/null @@ -1,438 +0,0 @@ -Calculator Distributed Sample -============================= -This sample implements a simple calculator using SCA components. It uses -exactly the same calculator application classes as the calculator sample but -runs the application distributed across three nodes. - -A node in this sample means an instance of the Tuscany SCA java runtime running -in a Java virtual machine. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open four command prompts and -navigate to this sample directory in each one. There is one command to be run -in each command prompt: - -ant runDomain -ant runNodeB -ant runNodeC -ant runNodeA - -Please run the commands in this order. - -OR if you don't have ant, on Windows use - -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchDomain -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeB -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeC -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.LaunchCalculatorNodeA - -and on *nix do - -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchDomain -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeB -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeC -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.LaunchCalculatorNodeA - - -The processes started on each of these command prompts can be ended by pressing -the key. - - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. NodeA exercises this interface by calling add, subtract, multiply and -divide operations. - -In the case of add and subtract the runtime recognises that -it can't find these services locally and, using the remote (web services) -version of the default SCA binding, contacts the add service running in NodeB -and the subtract service running in NodeC. - -On the command prompt where you started NodeA, you see the output of invoking the -calculator functions distributed over NodeB and and NodeC. On the command prompts -where you have started NodeB and NodeC, you see log messages that indicate that -the add and subtract services where called on these nodes respectively. - -The sample demonstrates that the calculator application can be distributed -across multiple nodes with no change to the application or to the SCA description -files. - -The domain node makes available a web application through which the contributions and -composites used in this sample can be navigated. One you have run "ant runDomain" you can -point you browser at: - -http://localhost:9990/ui/workspace/ - -The contents of the sample are as follows: - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - node/ - LaunchCalculatorNodeA.java - runs an sca node configured with the - composite describing the main calculator - application. If you look inside this class - you will see that the node is configured - using a URL of the form: - - http://localhost:9990/node-config/NodeA - - This retrieves the information required - to configure NodeA from the domain. - - Once the node has been started this launcher - then finds the calculator service and - calls the various methods. - - LaunchCalculatorNodeB&C.java - These launchers start nodes B and C - which runs the add and subtract services. - - Unlike NodeA though these launchers just - wait once the node has been started. They - will service incomming web service requests - as they arrive. - - LaunchDomain.java - the node that provides the domain - configuration to the distributed - nodes - resources/ - cloud - The SCA composite files that describe - the configuration of each node - nodeA - the SCA assembly for nodeA's part of the - calculator application - nodeB - the SCA assembly for nodeB's part of the - calculator application - nodeC - the SCA assembly for nodeC's part of the - calculator application - test/ - java/ - calculator/ - CalculatorDistributedTestCase.java - JUnit test case which runs all - of the separate nodes along with the domain - in a single VM for test purposes - calculator-distributed.png - a pictorial representation of the sample - .composite files - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator-distributed -ant compile -ant runDomain -ant runNodeB -ant runNodeC -ant runNodeA - -You should see the following output from the four separate command prompt: - -runDomain: -ted>ant runDomain -Buildfile: build.xml - -runDomain: - [java] 26-Mar-2008 12:55:12 org.apache.tuscany.sca.node.launcher.DomainMana -gerLauncher main - [java] INFO: Apache Tuscany SCA Domain Manager starting... - [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 -\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- -1.2-incubating-SNAPSHOT\lib - [java] 26-Mar-2008 12:55:13 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ -distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 -.2-incubating-SNAPSHOT\modules - [java] 26-Mar-2008 12:55:19 org.apache.catalina.core.StandardEngine start - [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.14 - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.ContextConfig defau -ltWebConfig - [java] INFO: No default web.xml - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0. -xsd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_1. -xsd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_1_1.dtd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_1_2.dtd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_2_0.xsd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_2_1.xsd - [java] 26-Mar-2008 12:55:20 org.apache.catalina.startup.DigesterFactory reg -ister - [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser -vices_1_1.xsd - [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol init - [java] INFO: Initializing Coyote HTTP/1.1 on http-9990 - [java] 26-Mar-2008 12:55:20 org.apache.coyote.http11.Http11Protocol start - [java] INFO: Starting Coyote HTTP/1.1 on http-9990 - [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/home/* - [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/workspace/* - [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/files/* - [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/composite/* - [java] 26-Mar-2008 12:55:20 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ui/cloud/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/workspace/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/contribution/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/feed/files/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/files/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-source/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/deployable/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-resolved/ -* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/cloud-source/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/composite-config/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/node-config/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/quickstart/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/processes/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/node/processes/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.http.tomcat.TomcatServer - addServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:9990/ping/* - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana -gerLauncher main - [java] INFO: SCA Domain Manager started. - [java] 26-Mar-2008 12:55:21 org.apache.tuscany.sca.node.launcher.DomainMana -gerLauncher main - [java] INFO: Press enter to shutdown. - - -runNodeB: - [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: Apache Tuscany SCA Node starting... - [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeB - - [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 -\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- -1.2-incubating-SNAPSHOT\lib - [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ -distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 -.2-incubating-SNAPSHOT\modules - [java] 26-Mar-2008 12:55:42 org.apache.tuscany.sca.node.impl.NodeImpl - [java] INFO: Creating node: http://localhost:9990/node-config/NodeB - [java] 26-Mar-2008 12:55:45 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist -ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i -ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeB/ - [java] 26-Mar-2008 12:55:46 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co -mposite:nodeB;http://sample;CalculatorB - [java] 26-Mar-2008 12:55:47 org.apache.tuscany.sca.node.impl.NodeImpl start - - [java] INFO: Starting node: http://localhost:9990/node-config/NodeB - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8200/AddServiceComponent -B - [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: SCA Node started. - [java] 26-Mar-2008 12:55:53 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: Press enter to shutdown. - [java] AddService - add 3.0 and 2.0 - -runNodeC: - [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: Apache Tuscany SCA Node starting... - [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: SCA Node configuration: http://localhost:9990/node-config/NodeC - - [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 147 JARs from C:\simon\tuscany\sca-java-1.2 -\distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca- -1.2-incubating-SNAPSHOT\lib - [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.launcher.NodeLaunch -erUtil collectJARFiles - [java] INFO: Runtime classpath: 89 JARs from C:\simon\tuscany\sca-java-1.2\ -distribution\target\apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir\tuscany-sca-1 -.2-incubating-SNAPSHOT\modules - [java] 26-Mar-2008 12:56:01 org.apache.tuscany.sca.node.impl.NodeImpl - [java] INFO: Creating node: http://localhost:9990/node-config/NodeC - [java] 26-Mar-2008 12:56:03 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist -ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i -ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeC/ - [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co -mposite:nodeC;http://sample;CalculatorC - [java] 26-Mar-2008 12:56:04 org.apache.tuscany.sca.node.impl.NodeImpl start - - [java] INFO: Starting node: http://localhost:9990/node-config/NodeC - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8300/SubtractServiceComp -onentC - [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: SCA Node started. - [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.launcher.NodeLaunch -er main - [java] INFO: Press enter to shutdown. - [java] SubtractService - subtract 3.0 and 2.0 - -runNodeA: - [java] 26-Mar-2008 12:56:10 org.apache.tuscany.sca.node.impl.NodeImpl - [java] INFO: Creating node: http://localhost:9990/node-config/NodeA - [java] 26-Mar-2008 12:56:12 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading contribution: file:/C:/simon/tuscany/sca-java-1.2/dist -ribution/target/apache-tuscany-sca-1.2-incubating-SNAPSHOT.dir/tuscany-sca-1.2-i -ncubating-SNAPSHOT/samples/calculator-distributed/./src/main/resources/nodeA/ - [java] 26-Mar-2008 12:56:13 org.apache.tuscany.sca.node.impl.NodeImpl confi -gureNode - [java] INFO: Loading composite: http://localhost:9990/composite-resolved/co -mposite:nodeA;http://sample;CalculatorA - [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co -mpositeBuilderImpl$1 problem - [java] WARNING: Component reference target not found, it might be a remote -service: SubtractServiceComponentC - [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.assembly.builder.impl.Co -mpositeBuilderImpl$1 problem - [java] WARNING: Component reference target not found, it might be a remote -service: AddServiceComponentB - [java] 26-Mar-2008 12:56:14 org.apache.tuscany.sca.node.impl.NodeImpl start - - [java] INFO: Starting node: http://localhost:9990/node-config/NodeA - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] CalculatorService - add 3.0 and 2.0 - [java] 3 + 2=5.0 - [java] CalculatorService - subtract 3.0 and 2.0 - [java] 3 - 2=1.0 - [java] CalculatorService - multiply 3.0 and 2.0 - [java] 3 * 2=6.0 - [java] CalculatorService - divide 3.0 and 2.0 - [java] 3 / 2=1.5 - [java] 26-Mar-2008 12:56:20 org.apache.tuscany.sca.node.impl.NodeImpl stop - [java] INFO: Stopping node: http://localhost:9990/node-config/NodeA - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When running from Maven the four nodes all run within -Java virtual machine. - -cd calculator-distributed -mvn - -You should see the following output at the end of the test phase. - -INFO: Starting node: http://localhost:9990/node-config/NodeA -CalculatorService - add 3.0 and 2.0 -AddService - add 3.0 and 2.0 -CalculatorService - subtract 3.0 and 2.0 -SubtractService - subtract 3.0 and 2.0 -CalculatorService - multiply 3.0 and 2.0 -CalculatorService - divide 3.0 and 2.0 -26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop -INFO: Stopping node: http://localhost:9990/node-config/NodeC -26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop -INFO: Stopping node: http://localhost:9990/node-config/NodeB -26-Mar-2008 13:00:52 org.apache.tuscany.sca.node.impl.NodeImpl stop -INFO: Stopping node: http://localhost:9990/node-config/NodeA -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.328 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. - - - diff --git a/java/sca/samples/calculator-distributed/build.xml b/java/sca/samples/calculator-distributed/build.xml deleted file mode 100644 index cccd22f3ae..0000000000 --- a/java/sca/samples/calculator-distributed/build.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/calculator-distributed.png b/java/sca/samples/calculator-distributed/calculator-distributed.png deleted file mode 100644 index 7c0e175664..0000000000 Binary files a/java/sca/samples/calculator-distributed/calculator-distributed.png and /dev/null differ diff --git a/java/sca/samples/calculator-distributed/calculator-distributed.svg b/java/sca/samples/calculator-distributed/calculator-distributed.svg deleted file mode 100644 index be5a4b8185..0000000000 --- a/java/sca/samples/calculator-distributed/calculator-distributed.svg +++ /dev/null @@ -1,383 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - - nodeB nodeC - nodeA - diff --git a/java/sca/samples/calculator-distributed/cloud.composite b/java/sca/samples/calculator-distributed/cloud.composite deleted file mode 100644 index 85e2f9c7f3..0000000000 --- a/java/sca/samples/calculator-distributed/cloud.composite +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/calculator-distributed/domain.composite b/java/sca/samples/calculator-distributed/domain.composite deleted file mode 100644 index 643e22d0cf..0000000000 --- a/java/sca/samples/calculator-distributed/domain.composite +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/calculator-distributed/pom.xml b/java/sca/samples/calculator-distributed/pom.xml deleted file mode 100644 index e1e86d8896..0000000000 --- a/java/sca/samples/calculator-distributed/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-distributed - Apache Tuscany SCA Distributed Calculator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-domain-manager - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-node-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-sca - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-sca-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 2.0-SNAPSHOT - runtime - - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/AddService.java deleted file mode 100644 index dd7ecb827d..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The Add service interface - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9b7e254e5..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - System.out.println("AddService - add " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index c927500cc7..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - public double add(double n1, double n2) { - System.out.println("CalculatorService - add " + n1 + " and " + n2); - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - System.out.println("CalculatorService - subtract " + n1 + " and " + n2); - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - System.out.println("CalculatorService - multiply " + n1 + " and " + n2); - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - System.out.println("CalculatorService - divide " + n1 + " and " + n2); - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index f7ac0b7287..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index b7dca792b2..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractService.java deleted file mode 100644 index f03b9b94d4..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the multiply service - */ -@Remotable -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1010207154..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - System.out.println("SubtractService - subtract " + n1 + " and " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java b/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java deleted file mode 100644 index 87021505b3..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeA.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.SCAClient; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.launcher.NodeLauncher; -import org.oasisopen.sca.ServiceRuntimeException; - -import calculator.CalculatorService; - -public class LaunchCalculatorNodeA { - public static void main(String[] args) throws Exception { - - SCANode node = null; - try { - - NodeLauncher nodeLauncher = NodeLauncher.newInstance(); - node = nodeLauncher.createNodeFromURL("http://localhost:9990/node-config/NodeA"); - - node.start(); - - // get a reference to the calculator component - SCAClient client = (SCAClient)node; - CalculatorService calculatorService = - client.getService(CalculatorService.class, "CalculatorServiceComponentA"); - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - if (args.length > 1){ - for (int i=0; i < 1000; i++){ - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - } - } - - node.stop(); - - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java b/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java deleted file mode 100644 index 50600eaedc..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeB.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchCalculatorNodeB { - public static void main(String[] args) throws Exception { - NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeB"}); - } -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java b/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java deleted file mode 100644 index 95d8934665..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchCalculatorNodeC.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchCalculatorNodeC { - public static void main(String[] args) throws Exception { - NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"}); - } -} diff --git a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchDomain.java b/java/sca/samples/calculator-distributed/src/main/java/node/LaunchDomain.java deleted file mode 100644 index 8b4fe566a1..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/java/node/LaunchDomain.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package node; - -import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; - -/** - * This server program that loads a composite to provide simple registry function. - * This server can be replaced with any registry that is appropriate but the components - * in each node that talk to the registry should be replaced also. - */ -public class LaunchDomain { - public static void main(String[] args) throws Exception { - DomainManagerLauncher.main(args); - } - -} diff --git a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite b/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite deleted file mode 100644 index ed7fe55abc..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeA.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite b/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite deleted file mode 100644 index 8f29cc17aa..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeB.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite b/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite deleted file mode 100644 index 9ad132b0d4..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/cloud/NodeC.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite b/java/sca/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite deleted file mode 100644 index 172676a3c7..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeA/Calculator.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml deleted file mode 100644 index 1b1c0291e2..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite b/java/sca/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite deleted file mode 100644 index b770dbe8d4..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeB/Calculator.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml deleted file mode 100644 index 6c0ffe4ac0..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite b/java/sca/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite deleted file mode 100644 index 66caf0d17b..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeC/Calculator.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml deleted file mode 100644 index 8c311553c3..0000000000 --- a/java/sca/samples/calculator-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java b/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java deleted file mode 100644 index 2a6f3af002..0000000000 --- a/java/sca/samples/calculator-distributed/src/test/java/calculator/CalculatorDistributedTestCase.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -import junit.framework.Assert; - -import org.apache.tuscany.sca.node.SCAClient; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Runs a distributed domain in a single VM by using and in memory - * implementation of the distributed domain - */ -public class CalculatorDistributedTestCase { - - private static SCANode manager; - private static SCANode nodeA; - private static SCANode nodeB; - private static SCANode nodeC; - - private static CalculatorService calculatorService; - - - @BeforeClass - public static void init() throws Exception { - - try { - System.out.println("Setting up domain"); - - DomainManagerLauncher managerLauncher = DomainManagerLauncher.newInstance(); - manager = managerLauncher.createDomainManager(); - manager.start(); - - SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); - nodeC = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeC"); - nodeB = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeB"); - nodeA = nodeFactory.createSCANodeFromURL("http://localhost:9990/node-config/NodeA"); - - nodeC.start(); - nodeB.start(); - nodeA.start(); - - SCAClient client = (SCAClient)nodeA; - calculatorService = - client.getService(CalculatorService.class, "CalculatorServiceComponentA"); - - } catch(Exception ex){ - System.err.println(ex.toString()); - } - - } - - @AfterClass - public static void destroy() throws Exception { - nodeC.stop(); - nodeB.stop(); - nodeA.stop(); - manager.stop(); - } - - @Test - public void testCalculator() throws Exception { - - // Calculate - Assert.assertEquals(calculatorService.add(3, 2), 5.0); - Assert.assertEquals(calculatorService.subtract(3, 2), 1.0); - Assert.assertEquals(calculatorService.multiply(3, 2), 6.0); - Assert.assertEquals(calculatorService.divide(3, 2), 1.5); - } -} diff --git a/java/sca/samples/calculator-distributed/workspace.xml b/java/sca/samples/calculator-distributed/workspace.xml deleted file mode 100644 index 7d6d3dbdbd..0000000000 --- a/java/sca/samples/calculator-distributed/workspace.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/java/sca/samples/calculator-equinox/README b/java/sca/samples/calculator-equinox/README deleted file mode 100644 index cde5fe981f..0000000000 --- a/java/sca/samples/calculator-equinox/README +++ /dev/null @@ -1,97 +0,0 @@ -Calculator Sample -================= -This sample implements a simple calculator using SCA components. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite across the local wires. - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - CalculatorServiceImpl.java - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - CalculatorClient.java - starts the SCA Runtime and - deploys the Calculator.composite. - It then calls the deployed Calculator - Components services - resources/ - Calculator.composite - the SCA assembly for this sample - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - calculator.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] 3 / 2=1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator-equinox/build.xml b/java/sca/samples/calculator-equinox/build.xml deleted file mode 100644 index 40938ebb8e..0000000000 --- a/java/sca/samples/calculator-equinox/build.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-equinox/calculator.png b/java/sca/samples/calculator-equinox/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/java/sca/samples/calculator-equinox/calculator.png and /dev/null differ diff --git a/java/sca/samples/calculator-equinox/calculator.svg b/java/sca/samples/calculator-equinox/calculator.svg deleted file mode 100644 index af34f07e04..0000000000 --- a/java/sca/samples/calculator-equinox/calculator.svg +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - diff --git a/java/sca/samples/calculator-equinox/pom.xml b/java/sca/samples/calculator-equinox/pom.xml deleted file mode 100644 index abdda77c77..0000000000 --- a/java/sca/samples/calculator-equinox/pom.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-equinox - Apache Tuscany SCA Calculator Equinox Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher-equinox - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-node-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-extensibility-equinox - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Add service interface - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 84c98d7f70..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -@Scope("COMPOSITE") @EagerInit -public class CalculatorClient { - - private CalculatorService calculatorService; - - @Reference - public void setCalculatorService(CalculatorService calculatorService) { - this.calculatorService = calculatorService; - } - - @Init - public void calculate() { - - // Calculate - System.out.println("SCA API ClassLoader: " + print(Reference.class.getClassLoader())); - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - } - - private static String print(ClassLoader cl) { - StringBuffer buf = new StringBuffer(); - for (; cl != null;) { - buf.append(cl.toString()); - buf.append(' '); - cl = cl.getParent(); - } - return buf.toString(); - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 17fad7de6b..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-equinox/src/main/resources/Calculator.composite b/java/sca/samples/calculator-equinox/src/main/resources/Calculator.composite deleted file mode 100644 index 913081b9be..0000000000 --- a/java/sca/samples/calculator-equinox/src/main/resources/Calculator.composite +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index b49e1da130..0000000000 --- a/java/sca/samples/calculator-equinox/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.equinox.launcher.Contribution; -import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper; -import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * This shows how to test the Calculator composition. - */ -public class CalculatorTestCase { - - private static NodeLauncher launcher; - private static Node node; - - public static void main(String[] args) throws Exception { - setUpBeforeClass(); - tearDownAfterClass(); - } - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - launcher = NodeLauncher.newInstance(); - String location = ContributionLocationHelper.getContributionLocation(CalculatorClient.class); - node = launcher.createNode("Calculator.composite", new Contribution("test", location)); - System.out.println("SCA Node API ClassLoader: " + node.getClass().getClassLoader()); - node.start(); - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (node != null) { - node.stop(); - node.destroy(); - } - if (launcher != null) { - launcher.destroy(); - } - } - - @Test - public void testDummy() throws Exception { - } -} diff --git a/java/sca/samples/calculator-implementation-policies/README b/java/sca/samples/calculator-implementation-policies/README deleted file mode 100644 index bd66eee1c9..0000000000 --- a/java/sca/samples/calculator-implementation-policies/README +++ /dev/null @@ -1,266 +0,0 @@ -Calculator Implementation Policies Sample -========================================= -This sample builds over simple calculator sample to demonstrate how Implementation Policies can -be use in Tuscany SCA Java. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run the sample to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient - - -Sample Overview ---------------- -The sample provides the calculator service with a default SCA (java) binding. The 'logging' policy -which is handled by the Tuscany SCA java policy-logging module is used in this calculator -composite to specify the need for 'logging'. The MultiplyService Component specifies for 'jassAuthentication' -which is one way of implemention login authentication, using the Java Authentication and Authorization Service. - -The logging intent and policyset that is to be used by this calculator application must be -defined in the definitions.xml file. Here we use the policyset structure already defined in -Tuscany for logging under the policy-logging and hence there is no need to specify the policyset processors -and policy handler classes as part of this application. - -Similarly the jaasAuthentication intent and policyset also is defined in the definitions.xml file -of this sample. This sample uses the calculator.security.JaasLoginModule class for handling the -authentication functions. Right now there is a simply matching of userid and passwords that happens in this -class. Applications could implement their own sophisticated authentication mechanisms. For more information -on how to do this please look up Java Authentication and Authorization Service documentation. The sample -also use the calculator.security.CalculatorCallbackHandler to fetch the userid and password to be use for the -login authentication. This handler presently uses hardcoded userids and passwords. Applications could -typically use this handler to prompt for userid and passwords. - -There are two components that provide the calculator service namely 'CalculatorServiceComponent' -and 'AnotherCalculatorServiceComponent'. The logging intent is specified for the 'subtract' and 'divide' -operations of the 'CalculatorServiceCompnent' implementation, and on the entire implementation -(i.e. all operations) for the AddServiceComponent and AnotherCalculatorServiceComponent. - -The CalculatorClient first exercises the CalculatorServiceComponent calling add, -subtract, multiply and divide operations. This results in logging messages appearing on the -console for 'add', 'subtract' and 'divide' operations. The CalculatorClient then exercises the -AnotherCalculatorServiceComponent calling all the service methods. This will result in logging messages -printed on the console for all the operations. For the 'add' operation there will be two sets of messages -printed - one that has resulted from specifying the 'logging' intent on the implementation element of the -'AnotherCalculatorServiceComponent' and another from specifying the 'logging' intent on the -'AddServiceComponent' - -The jaasAuthentication intent is specified for the 'MultiplyServiceComponent'. So everytime this component -is invoke an authentication is attempted and only if it succeeds, is the multiply function is invoked. The -console prints messages that denote if the authentication has succeeded or failed. - -Thus this sample demonstrates how intents could be applied to either implementations as a whole or to some -selective operations on an implementation. - - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - CalculatorServiceImpl.java - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - CalculatorClient.java - starts the SCA Runtime and - deploys the Calculator.composite. - It then calls the deployed Calculator - Components services - calculator/security - JaasLoginModule.java JaasLoginModule implementation for this sample - CalculatorCallbackHandler.java JAAS callbackhandler for fetching userid and password - - - resources/ - Calculator.composite - the SCA assembly for this sample - definitions.xml - sca definitions file that defines the 'logging' intent - and policyset - used by this application - CalculatorLogMessages.properties - A resource bundle contain the log messages to be - used. - CalculatorJaas.config - JAAS Login Configuration file - - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - calculator.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator-implementation-policies -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Calling CalculatorServiceComponent configured with 'logging' policy for subtract and divide operations... - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - add - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - add - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] 3 / 2=1.5 - [java] Calling CalculatorServiceComponent configured with 'logging' for all operations in the implementation... - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - subtract - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - subtract - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - divide - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - divide - [java] Nov 23, 2007 1:06:10 PM - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] INFO: Invoking operation - add - [java] 3 / 2=1.5 - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - add - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - add - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - add - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - subtract - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - subtract - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - multiply - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - multiply - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Invoking operation - divide - [java] Nov 23, 2007 1:06:10 PM - [java] INFO: Returned from operation - divide - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator -mvn - -You should see the following output from the test phase. Notice the log messages. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error -WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/ -classes/Calculator.composite, line: 28, column: 4 -cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www. -osoa.org/xmlns/sca/1.0"]}' is expected. -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - add -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation add with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - add -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation add with return value 5 -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - subtract -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation subtract with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - subtract -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation subtract with return value 1 -Successfully AUTHENTICATED!! -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - divide -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation divide with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - divide -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation divide with return value 1.5 -Dec 18, 2007 12:05:06 PM org.apache.tuscany.sca.contribution.processor.ValidatingXMLStreamReader$1 error -WARNING: XMLSchema validation problem in: file:/F:/LatestTrunk/sca/samples/calculator-implementation-policies/target/ -classes/Calculator.composite, line: 28, column: 4 -cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{WC[##other:"http://www. -osoa.org/xmlns/sca/1.0"]}' is expected. -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - add -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation add with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - add -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation add with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - add -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation add with return value 5 -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - add -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation add with return value 5 -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - subtract -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation subtract with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - subtract -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation subtract with return value 1 -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - multiply -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation multiply with arguments 3.0, 2.0, -Successfully AUTHENTICATED!! -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - multiply -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation multiply with return value 6 -Dec 18, 2007 12:05:06 PM -INFO: Invoking operation - divide -Dec 18, 2007 12:05:06 PM -FINER: Inovoking operation divide with arguments 3.0, 2.0, -Dec 18, 2007 12:05:06 PM -INFO: Returned from operation - divide -Dec 18, 2007 12:05:06 PM -FINER: Returning from operation divide with return value 1.5 -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.823 sec - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator-implementation-policies/build.xml b/java/sca/samples/calculator-implementation-policies/build.xml deleted file mode 100644 index 7afa23a07f..0000000000 --- a/java/sca/samples/calculator-implementation-policies/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-implementation-policies/calculator.png b/java/sca/samples/calculator-implementation-policies/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/java/sca/samples/calculator-implementation-policies/calculator.png and /dev/null differ diff --git a/java/sca/samples/calculator-implementation-policies/calculator.svg b/java/sca/samples/calculator-implementation-policies/calculator.svg deleted file mode 100644 index af34f07e04..0000000000 --- a/java/sca/samples/calculator-implementation-policies/calculator.svg +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - diff --git a/java/sca/samples/calculator-implementation-policies/pom.xml b/java/sca/samples/calculator-implementation-policies/pom.xml deleted file mode 100644 index 7bc0be2dca..0000000000 --- a/java/sca/samples/calculator-implementation-policies/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-impl-policies - Apache Tuscany SCA Calculator Sample using Implementation Policies - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - org.apache.tuscany.sca - tuscany-policy-logging - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-policy-security - 2.0-SNAPSHOT - runtime - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java deleted file mode 100644 index 5a1e7a638a..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Add service interface - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index caf4d358df..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 2bce187049..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import javax.security.auth.login.Configuration; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - try { - Configuration secConf = Configuration.getConfiguration(); - } catch (java.lang.SecurityException e) { - System.setProperty("java.security.auth.login.config", CalculatorClient.class.getClassLoader() - .getResource("CalculatorJass.config").toString()); - } - - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); - - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - // Calculate - System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + - "policy for subtract and divide operations..."); - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - calculatorService = - scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); - - // Calculate - System.out.println("Calling CalculatorServiceComponent configured with 'logging' " + - "for all operations in the implementation..."); - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index ad87375529..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index d3fa7a8f41..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java deleted file mode 100644 index ef6a8b375b..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index cd91935f08..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index c85357fcd8..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 56ee372fc4..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1b669084d9..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java deleted file mode 100644 index b48fb90148..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/CalculatorCallbackHandler.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.security; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; - -/** - * @version $Rev$ $Date$ - */ -public class CalculatorCallbackHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - if (callbacks[i] instanceof NameCallback) { - NameCallback nc = (NameCallback)callbacks[i]; - nc.setName("CalculatorUser"); - } else if (callbacks[i] instanceof PasswordCallback) { - PasswordCallback pc = (PasswordCallback)callbacks[i]; - pc.setPassword("CalculatorUserPasswd".toCharArray()); - } else { - throw new UnsupportedCallbackException - (callbacks[i], "Unsupported Callback!"); - } - } - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java deleted file mode 100644 index fe4097640b..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/JaasLoginModule.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator.security; - -import java.security.Principal; -import java.util.Map; - -import javax.security.auth.Subject; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.NameCallback; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.login.LoginException; -import javax.security.auth.spi.LoginModule; - -/** - * @version $Rev$ $Date$ - */ -public class JaasLoginModule implements LoginModule { - - private CallbackHandler callbackHandler; - private Subject subject; - private Principal userPrincipal; - private String userId; - private String password; - private boolean succeeded; - private boolean commitSucceeded; - - public void initialize(Subject subject, - CallbackHandler callbackHandler, - Map sharedState, - Map options) { - this.callbackHandler = callbackHandler; - this.subject = subject; - } - - public boolean login() throws LoginException { - Callback[] callbacks = new Callback[2]; - callbacks[0] = new NameCallback("UserId:"); - callbacks[1] = new PasswordCallback("Password:", false); - - try { - callbackHandler.handle(callbacks); - userId = ((NameCallback)callbacks[0]).getName(); - password = new String(((PasswordCallback)callbacks[1]).getPassword()); - - if (userId.equals("CalculatorUser") && password.equals("CalculatorUserPasswd")) { - System.out.println("Successfully AUTHENTICATED!!"); - succeeded = true; - return true; - } else { - System.out.println("Incorrect userId / password! AUTHENTICATION FAILED!!"); - return false; - } - } catch (Exception e) { - e.printStackTrace(); - return false; - } - } - - /** - *

This method is called if the LoginContext's - * overall authentication succeeded - * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules - * succeeded). - * - *

If this LoginModule's own authentication attempt - * succeeded (checked by retrieving the private state saved by the - * login method), then this method associates a - * UserPrincipal - * with the Subject located in the - * LoginModule. If this LoginModule's own - * authentication attempted failed, then this method removes - * any state that was originally saved. - * - *

- * - * @exception LoginException if the commit fails. - * - * @return true if this LoginModule's own login and commit - * attempts succeeded, or false otherwise. - */ - public boolean commit() throws LoginException { - if (succeeded == false) { - return false; - } else { - // add a Principal (authenticated identity) to the Subject - - // assume the user we authenticated is the UserPrincipal - userPrincipal = new UserPrincipal(userId); - if (!subject.getPrincipals().contains(userPrincipal)) - subject.getPrincipals().add(userPrincipal); - - // in any case, clean out state - userId = null; - password = null; - commitSucceeded = true; - return true; - } - } - - /** - *

This method is called if the LoginContext's - * overall authentication failed. - * (the relevant REQUIRED, REQUISITE, SUFFICIENT and OPTIONAL LoginModules - * did not succeed). - * - *

If this LoginModule's own authentication attempt - * succeeded (checked by retrieving the private state saved by the - * login and commit methods), - * then this method cleans up any state that was originally saved. - * - *

- * - * @exception LoginException if the abort fails. - * - * @return false if this LoginModule's own login and/or commit attempts - * failed, and true otherwise. - */ - public boolean abort() throws LoginException { - if (succeeded == false) { - return false; - } else if (succeeded == true && commitSucceeded == false) { - // login succeeded but overall authentication failed - succeeded = false; - userId = null; - password = null; - userPrincipal = null; - } else { - // overall authentication succeeded and commit succeeded, - // but someone else's commit failed - logout(); - } - return true; - } - - /** - * Logout the user. - * - *

This method removes the SimplePrincipal - * that was added by the commit method. - * - *

- * - * @exception LoginException if the logout fails. - * - * @return true in all cases since this LoginModule - * should not be ignored. - */ - public boolean logout() throws LoginException { - subject.getPrincipals().remove(userPrincipal); - succeeded = false; - succeeded = commitSucceeded; - userId = null; - if (password != null) - password = null; - userPrincipal = null; - return true; - } - -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java b/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java deleted file mode 100644 index 595626e672..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/java/calculator/security/UserPrincipal.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package calculator.security; - -import java.security.Principal; - -/** - * @version $Rev$ $Date$ - */ -public class UserPrincipal implements Principal { - - private final String name; - - public UserPrincipal(String name) { - if (name == null) - throw new IllegalArgumentException("name cannot be null"); - this.name = name; - } - - public String getName() { - return name; - } - - public String toString() { - return name; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final UserPrincipal other = (UserPrincipal)obj; - if (name == null) { - if (other.name != null) - return false; - } else if (!name.equals(other.name)) - return false; - return true; - } -} diff --git a/java/sca/samples/calculator-implementation-policies/src/main/resources/Calculator.composite b/java/sca/samples/calculator-implementation-policies/src/main/resources/Calculator.composite deleted file mode 100644 index d91bf88d96..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/resources/Calculator.composite +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config b/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config deleted file mode 100644 index 0e7cb86633..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorJass.config +++ /dev/null @@ -1,3 +0,0 @@ -Calculator { - calculator.security.JaasLoginModule required debug=true; -}; diff --git a/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties b/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties deleted file mode 100644 index f62125eaa9..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/resources/CalculatorLogMessages.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -CALLING_OPERATION=Inovoking operation {0} with arguments {1} -OPERATION_RETURNED=Returning from operation {0} with return value {1} \ No newline at end of file diff --git a/java/sca/samples/calculator-implementation-policies/src/main/resources/definitions.xml b/java/sca/samples/calculator-implementation-policies/src/main/resources/definitions.xml deleted file mode 100644 index 6cccde0d13..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/main/resources/definitions.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - Calculator - calculator.security.CalculatorCallbackHandler - - - - - - - FINER - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 157570c3df..0000000000 --- a/java/sca/samples/calculator-implementation-policies/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import javax.security.auth.login.Configuration; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorTestCase extends TestCase { - - private CalculatorService calculatorService; - private CalculatorService anotherCalculatorService; - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - try { - Configuration secConf = Configuration.getConfiguration(); - } catch ( java.lang.SecurityException e ) { - //FIXME: We should not compare exception strings as they are localized in various languages - //if ( e.getMessage().equals("Unable to locate a login configuration") ) { - System.setProperty("java.security.auth.login.config", - this.getClass().getClassLoader().getResource("CalculatorJass.config").toString()); - //} else { - // throw e; - //} - } - scaDomain = SCADomain.newInstance("Calculator.composite"); - calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - anotherCalculatorService = scaDomain.getService(CalculatorService.class, "AnotherCalculatorServiceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testCalculator() throws Exception { - // Calculate - assertEquals(calculatorService.add(3, 2), 5.0); - assertEquals(calculatorService.subtract(3, 2), 1.0); - assertEquals(calculatorService.multiply(3, 2), 6.0); - assertEquals(calculatorService.divide(3, 2), 1.5); - } - - public void testAnotherCalculator() throws Exception { - // Calculate - assertEquals(anotherCalculatorService.add(3, 2), 5.0); - assertEquals(anotherCalculatorService.subtract(3, 2), 1.0); - assertEquals(anotherCalculatorService.multiply(3, 2), 6.0); - assertEquals(anotherCalculatorService.divide(3, 2), 1.5); - } -} diff --git a/java/sca/samples/calculator-lean/README b/java/sca/samples/calculator-lean/README deleted file mode 100644 index a8aff232c6..0000000000 --- a/java/sca/samples/calculator-lean/README +++ /dev/null @@ -1,87 +0,0 @@ -Calculator Sample -================= -This sample implements a simple calculator using SCA components. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -java -jar /modules/tuscany-node-launcher.jar Calculator.composite target/sample-calculator-lean.jar - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite across the local wires. - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - CalculatorServiceImpl.java - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - CalculatorClient.java - a client component that calls the - Calculator services - resources/ - Calculator.composite - the SCA assembly for this sample - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - calculator.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] 3 / 2=1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator-lean/calculator.png b/java/sca/samples/calculator-lean/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/java/sca/samples/calculator-lean/calculator.png and /dev/null differ diff --git a/java/sca/samples/calculator-lean/calculator.svg b/java/sca/samples/calculator-lean/calculator.svg deleted file mode 100644 index 0615925c50..0000000000 --- a/java/sca/samples/calculator-lean/calculator.svg +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - diff --git a/java/sca/samples/calculator-lean/pom.xml b/java/sca/samples/calculator-lean/pom.xml deleted file mode 100644 index a68887b9b5..0000000000 --- a/java/sca/samples/calculator-lean/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-lean - Apache Tuscany SCA Calculator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-lean/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Add service interface - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index d56aa86e09..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -@Scope("COMPOSITE") @EagerInit -public class CalculatorClient { - - private CalculatorService calculatorService; - - @Reference - public void setCalculatorService(CalculatorService calculatorService) { - this.calculatorService = calculatorService; - } - - @Init - public void calculate() { - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 17fad7de6b..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-lean/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/java/sca/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-lean/src/main/resources/Calculator.composite b/java/sca/samples/calculator-lean/src/main/resources/Calculator.composite deleted file mode 100644 index 913081b9be..0000000000 --- a/java/sca/samples/calculator-lean/src/main/resources/Calculator.composite +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-lean/src/main/resources/CalculatorTest.composite b/java/sca/samples/calculator-lean/src/main/resources/CalculatorTest.composite deleted file mode 100644 index 906e2a3918..0000000000 --- a/java/sca/samples/calculator-lean/src/main/resources/CalculatorTest.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 94dc747734..0000000000 --- a/java/sca/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * This shows how to test the Calculator composition. - */ -@Scope("COMPOSITE") @EagerInit -public class CalculatorTestCase extends TestCase { - - private static CalculatorService calculatorService; - private SCANode node; - - @Reference - public void setCalculatorService(CalculatorService calculatorService) { - CalculatorTestCase.calculatorService = calculatorService; - } - - @Override - protected void setUp() throws Exception { - SCANodeFactory factory = SCANodeFactory.newInstance(); - node = factory.createSCANodeFromClassLoader("CalculatorTest.composite", getClass().getClassLoader()); - node.start(); - } - - @Override - protected void tearDown() throws Exception { - node.stop(); - } - - public void testCalculator() throws Exception { - // Calculate - assertEquals(calculatorService.add(3, 2), 5.0); - assertEquals(calculatorService.subtract(3, 2), 1.0); - assertEquals(calculatorService.multiply(3, 2), 6.0); - assertEquals(calculatorService.divide(3, 2), 1.5); - } -} diff --git a/java/sca/samples/calculator-rcp/build.properties b/java/sca/samples/calculator-rcp/build.properties deleted file mode 100644 index 0530eb648b..0000000000 --- a/java/sca/samples/calculator-rcp/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -source.. = src/main/java/ -output.. = target/classes/ -bin.includes = plugin.xml,\ - META-INF/,\ - . diff --git a/java/sca/samples/calculator-rcp/icons/alt_window_16.gif b/java/sca/samples/calculator-rcp/icons/alt_window_16.gif deleted file mode 100644 index 05626b17d8..0000000000 Binary files a/java/sca/samples/calculator-rcp/icons/alt_window_16.gif and /dev/null differ diff --git a/java/sca/samples/calculator-rcp/icons/alt_window_32.gif b/java/sca/samples/calculator-rcp/icons/alt_window_32.gif deleted file mode 100644 index b432f88339..0000000000 Binary files a/java/sca/samples/calculator-rcp/icons/alt_window_32.gif and /dev/null differ diff --git a/java/sca/samples/calculator-rcp/plugin.xml b/java/sca/samples/calculator-rcp/plugin.xml deleted file mode 100644 index 1fb5acd9b5..0000000000 --- a/java/sca/samples/calculator-rcp/plugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-rcp/pom.xml b/java/sca/samples/calculator-rcp/pom.xml deleted file mode 100644 index 0e5214cdd0..0000000000 --- a/java/sca/samples/calculator-rcp/pom.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample.calculator.rcp - Apache Tuscany SCA Calculator RCP Sample - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-implementation-node-runtime - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-extensibility-equinox - 2.0-SNAPSHOT - runtime - - - org.apache.tuscany.sca - tuscany-node-launcher-equinox - 2.0-SNAPSHOT - compile - - - - javax.servlet - servlet-api - 2.5 - provided - - - junit - junit - 4.5 - test - - - - ${artifactId} - - - maven-eclipse-plugin - 2.5.1 - - - org.eclipse.pde.ManifestBuilder - org.eclipse.jdt.core.javabuilder - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - - - org.eclipse.jdt.launching.JRE_CONTAINER - - org.eclipse.pde.core.requiredPlugins - - - - - - maven-jar-plugin - - - ${basedir}/META-INF/MANIFEST.MF - - - - - - diff --git a/java/sca/samples/calculator-rcp/src/main/java/Calculator.composite b/java/sca/samples/calculator-rcp/src/main/java/Calculator.composite deleted file mode 100644 index 913081b9be..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/Calculator.composite +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Add service interface - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index afd5ea48fc..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -@Scope("COMPOSITE") -@EagerInit -public class CalculatorClient { - - private CalculatorService calculatorService; - - @Reference - public void setCalculatorService(CalculatorService calculatorService) { - this.calculatorService = calculatorService; - } - - @Init - public void calculate() { - // Calculate - System.out.println("SCA API ClassLoader: " + Reference.class.getClassLoader()); - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index c89043276e..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 39f55ca31f..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java deleted file mode 100644 index 50f68dcb01..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Activator.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import java.io.File; - -import org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoverer; -import org.apache.tuscany.sca.node.SCAContribution; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "org.apache.tuscany.sca.sample.calculator.rcp"; - - // The shared instance - private static Activator plugin; - - private SCANode node; - - /** - * The constructor - */ - public Activator() { - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - Class cls = EquinoxServiceDiscoverer.class; - SCANodeFactory factory = SCANodeFactory.newInstance(); - node = factory.createSCANode("Calculator.composite", new SCAContribution("c1", new File("target/classes").toURI().toString())); - node.start(); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - if (node != null) { - node.stop(); - } - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /** - * Returns an image descriptor for the image file at the given - * plug-in relative path - * - * @param path the path - * @return the image descriptor - */ - public static ImageDescriptor getImageDescriptor(String path) { - return imageDescriptorFromPlugin(PLUGIN_ID, path); - } -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java deleted file mode 100644 index 5ce6522fed..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Application.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.equinox.app.IApplication; -import org.eclipse.equinox.app.IApplicationContext; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; - -/** - * This class controls all aspects of the application's execution - */ -public class Application implements IApplication { - - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) - */ - public Object start(IApplicationContext context) { - Display display = PlatformUI.createDisplay(); - try { - int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); - if (returnCode == PlatformUI.RETURN_RESTART) { - return IApplication.EXIT_RESTART; - } - return IApplication.EXIT_OK; - } finally { - display.dispose(); - } - } - - /* (non-Javadoc) - * @see org.eclipse.equinox.app.IApplication#stop() - */ - public void stop() { - final IWorkbench workbench = PlatformUI.getWorkbench(); - if (workbench == null) - return; - final Display display = workbench.getDisplay(); - display.syncExec(new Runnable() { - public void run() { - if (!display.isDisposed()) - workbench.close(); - } - }); - } -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java deleted file mode 100644 index 2fccfb2d77..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationActionBarAdvisor.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; -import org.eclipse.ui.application.ActionBarAdvisor; -import org.eclipse.ui.application.IActionBarConfigurer; - -/** - * An action bar advisor is responsible for creating, adding, and disposing of - * the actions added to a workbench window. Each window will be populated with - * new actions. - */ -public class ApplicationActionBarAdvisor extends ActionBarAdvisor { - - // Actions - important to allocate these only in makeActions, and then use - // them - // in the fill methods. This ensures that the actions aren't recreated - // when fillActionBars is called with FILL_PROXY. - private IWorkbenchAction exitAction; - - public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { - super(configurer); - } - - protected void makeActions(final IWorkbenchWindow window) { - // Creates the actions and registers them. - // Registering is needed to ensure that key bindings work. - // The corresponding commands keybindings are defined in the plugin.xml - // file. - // Registering also provides automatic disposal of the actions when - // the window is closed. - - exitAction = ActionFactory.QUIT.create(window); - register(exitAction); - } - - protected void fillMenuBar(IMenuManager menuBar) { - MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); - menuBar.add(fileMenu); - fileMenu.add(exitAction); - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java deleted file mode 100644 index ac1893509c..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchAdvisor.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.ui.application.IWorkbenchWindowConfigurer; -import org.eclipse.ui.application.WorkbenchAdvisor; -import org.eclipse.ui.application.WorkbenchWindowAdvisor; - -public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - - private static final String PERSPECTIVE_ID = "org.apache.tuscany.sca.sample.calculator.rcp.perspective"; - - public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - return new ApplicationWorkbenchWindowAdvisor(configurer); - } - - public String getInitialWindowPerspectiveId() { - return PERSPECTIVE_ID; - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java deleted file mode 100644 index 6378decf20..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/ApplicationWorkbenchWindowAdvisor.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.swt.graphics.Point; -import org.eclipse.ui.application.ActionBarAdvisor; -import org.eclipse.ui.application.IActionBarConfigurer; -import org.eclipse.ui.application.IWorkbenchWindowConfigurer; -import org.eclipse.ui.application.WorkbenchWindowAdvisor; - -public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { - - public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { - super(configurer); - } - - public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { - return new ApplicationActionBarAdvisor(configurer); - } - - public void preWindowOpen() { - IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); - configurer.setInitialSize(new Point(400, 300)); - configurer.setShowCoolBar(false); - configurer.setShowStatusLine(false); - configurer.setTitle("Tuscany SCA Calculator RCP Application"); - } -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java deleted file mode 100644 index 445b4b65b2..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/Perspective.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.ui.IPageLayout; -import org.eclipse.ui.IPerspectiveFactory; - -public class Perspective implements IPerspectiveFactory { - - public void createInitialLayout(IPageLayout layout) { - String editorArea = layout.getEditorArea(); - layout.setEditorAreaVisible(false); - layout.setFixed(true); - - layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea); - } - -} diff --git a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/View.java b/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/View.java deleted file mode 100644 index f95c1e029c..0000000000 --- a/java/sca/samples/calculator-rcp/src/main/java/calculator/rcp/View.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.rcp; - -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.part.ViewPart; - -public class View extends ViewPart { - public static final String ID = "org.apache.tuscany.sca.sample.calculator.rcp.view"; - - private TableViewer viewer; - - /** - * The content provider class is responsible for providing objects to the - * view. It can wrap existing objects in adapters or simply return objects - * as-is. These objects may be sensitive to the current input of the view, - * or ignore it and always show the same content (like Task List, for - * example). - */ - class ViewContentProvider implements IStructuredContentProvider { - public void inputChanged(Viewer v, Object oldInput, Object newInput) { - } - - public void dispose() { - } - - public Object[] getElements(Object parent) { - return new String[] {"One", "Two", "Three"}; - } - } - - class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { - public String getColumnText(Object obj, int index) { - return getText(obj); - } - - public Image getColumnImage(Object obj, int index) { - return getImage(obj); - } - - public Image getImage(Object obj) { - return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); - } - } - - /** - * This is a callback that will allow us to create the viewer and initialize - * it. - */ - public void createPartControl(Composite parent) { - viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); - viewer.setContentProvider(new ViewContentProvider()); - viewer.setLabelProvider(new ViewLabelProvider()); - viewer.setInput(getViewSite()); - } - - /** - * Passing the focus request to the viewer's control. - */ - public void setFocus() { - viewer.getControl().setFocus(); - } -} diff --git a/java/sca/samples/calculator-script/README b/java/sca/samples/calculator-script/README deleted file mode 100644 index ab1dda13df..0000000000 --- a/java/sca/samples/calculator-script/README +++ /dev/null @@ -1,105 +0,0 @@ -Calculator Script Sample -======================== -This sample implements a simple calculator using SCA components implemented -using Java, JavaScript, Ruby, Python and Groovy. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-script.jar calculator.CalculatorClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator-script.jar calculator.CalculatorClient - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing -to the appropriate components in the composite across the local wires. Each -component is implemented using a different language. - -calculator-script/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component calls +-/* as - appropriate - CalculatorServiceImpl.java - AddService.java - adds two numbers - SubtractService.java - subtracts one number from another - MultiplyService.java - multiplies two numbers - DivideService.java - divides one number by another - CalculatorClient.java - starts the SCA Runtime and - deploys the Calculator.composite. - It then calls the deployed Calculator - Components services - resources/ - calculator/ - AddServiceImpl.js - A JavaScript implementation of the - Add component - SubtractServiceImpl.rb - A Ruby implementation of the Subtract - component - MultiplyServiceImpl.py - A Python implementation of the - Multiple component - DivideServiceImpl.groovy- A Groovy implementation of the - Divide component - Calculator.composite - the SCA assembly for this sample - - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - calculator-script.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator-script -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] 3 / 2=1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-script -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.918 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator-script/build.xml b/java/sca/samples/calculator-script/build.xml deleted file mode 100644 index 429d638ca5..0000000000 --- a/java/sca/samples/calculator-script/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-script/calculator-script.png b/java/sca/samples/calculator-script/calculator-script.png deleted file mode 100644 index d3f8c491c3..0000000000 Binary files a/java/sca/samples/calculator-script/calculator-script.png and /dev/null differ diff --git a/java/sca/samples/calculator-script/calculator-script.svg b/java/sca/samples/calculator-script/calculator-script.svg deleted file mode 100644 index 16939f9310..0000000000 --- a/java/sca/samples/calculator-script/calculator-script.svg +++ /dev/null @@ -1,334 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent(Java) - - - CalculatorService - AddServiceComponent(Javascript) - - SubtractServiceComponent(Ruby) - - MultiplyServiceComponent(Python) - - DivideServiceComponent(Groovy) - addService - subtractService - multiplyService - divideService - - - - - - diff --git a/java/sca/samples/calculator-script/pom.xml b/java/sca/samples/calculator-script/pom.xml deleted file mode 100644 index 4ed19c0751..0000000000 --- a/java/sca/samples/calculator-script/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-script - Apache Tuscany SCA Calculator Sample using Scripting Languages - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-script - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-script/src/main/java/calculator/AddService.java deleted file mode 100644 index a235e648c7..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the add service - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 243d1562dc..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - } - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index c89043276e..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 39f55ca31f..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-script/src/main/java/calculator/DivideService.java deleted file mode 100644 index 497dafd4fd..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-script/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-script/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-script/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 376b3e5bb9..0000000000 --- a/java/sca/samples/calculator-script/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-script/src/main/resources/Calculator.composite b/java/sca/samples/calculator-script/src/main/resources/Calculator.composite deleted file mode 100644 index 8a765e6153..0000000000 --- a/java/sca/samples/calculator-script/src/main/resources/Calculator.composite +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js b/java/sca/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js deleted file mode 100644 index 1d4d221364..0000000000 --- a/java/sca/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -function add(n1, n2) { - return n1 + n2; -} \ No newline at end of file diff --git a/java/sca/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy deleted file mode 100644 index c31c1e8fd6..0000000000 --- a/java/sca/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -def divide(n1, n2) { - return n1 / n2 -} \ No newline at end of file diff --git a/java/sca/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py deleted file mode 100644 index d6f27ca7f5..0000000000 --- a/java/sca/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -def multiply(n1, n2): - return n1 * n2 \ No newline at end of file diff --git a/java/sca/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb deleted file mode 100644 index 132a1d13b0..0000000000 --- a/java/sca/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -def subtract(n1, n2) - return n1 - n2 -end \ No newline at end of file diff --git a/java/sca/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index fea8f62110..0000000000 --- a/java/sca/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorTestCase extends TestCase { - - private SCADomain scaDomain; - private CalculatorService calculatorService; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("Calculator.composite"); - calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testCalculator() throws Exception { - // Calculate - assertEquals(calculatorService.add(3, 2), 5.0); - assertEquals(calculatorService.subtract(3, 2), 1.0); - assertEquals(calculatorService.multiply(3, 2), 6.0); - assertEquals(calculatorService.divide(3, 2), 1.5); - - } -} diff --git a/java/sca/samples/calculator-webapp/README b/java/sca/samples/calculator-webapp/README deleted file mode 100644 index c88b92b206..0000000000 --- a/java/sca/samples/calculator-webapp/README +++ /dev/null @@ -1,118 +0,0 @@ -Calculator Sample -================= -This sample uses the same code as the calculator sample but deploys the -sample wrapped in a web app. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-calculator-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-webapp/calc.jsp - -The port and hostname will of course vary depending on your local installation. - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite across the local wires. - -calculator-webapp/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - As calculator sample - CalculatorServiceImpl.java - AddService.java - As calculator sample - AddServiceImpl.java - SubtractService.java - As calculator sample - SubtractServiceImpl.java - MultiplyService.java - As calculator sample - MultiplyServiceImpl.java - DivideService.java - As calculator sample - DivideServiceImpl.java - CalculatorClient.java - As calculator sample - resources/ - Calculator.composite - As calculator sample - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - calc.jsp - the web application that makes use of the - SCA application - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - - calculator.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd calculator-webapp -ant package - -This should result in a war file (sample-calculator-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in you -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-webapp/calc.jsp - -The port and hostname will of course vary depending on your local installation. - -You should see the following output. - -Expression Result -2 + 3 5.0 -3 - 2 1.0 -3 * 2 6.0 -3 / 2 1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-webapp -mvn - - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.852 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -Again this should result in a war file (sample-calculator-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/calculator-webapp/calculator-web.png b/java/sca/samples/calculator-webapp/calculator-web.png deleted file mode 100644 index 896ddc4093..0000000000 Binary files a/java/sca/samples/calculator-webapp/calculator-web.png and /dev/null differ diff --git a/java/sca/samples/calculator-webapp/calculator-web.svg b/java/sca/samples/calculator-webapp/calculator-web.svg deleted file mode 100644 index 00ed27556f..0000000000 --- a/java/sca/samples/calculator-webapp/calculator-web.svg +++ /dev/null @@ -1,358 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - WebApp - - diff --git a/java/sca/samples/calculator-webapp/pom.xml b/java/sca/samples/calculator-webapp/pom.xml deleted file mode 100644 index d2152897dc..0000000000 --- a/java/sca/samples/calculator-webapp/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-webapp - war - Apache Tuscany SCA Calculator Sample in a WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/AddService.java deleted file mode 100644 index ec57a6a533..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the add service - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e9c635e3c8..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index ad87375529..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 0f03d6e7a1..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 8c33862f6d..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index c7fbc73c00..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1a7f145ad8..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index 57d39cd8d8..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-calculator-webapp - 2.0-SNAPSHOT - war - - - diff --git a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite b/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite deleted file mode 100644 index 50c23af0b2..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.composite +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index b5a828d55b..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Calculator Web Service Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - calc.jsp - - - diff --git a/java/sca/samples/calculator-webapp/src/main/webapp/calc.jsp b/java/sca/samples/calculator-webapp/src/main/webapp/calc.jsp deleted file mode 100644 index 4bc5c984dd..0000000000 --- a/java/sca/samples/calculator-webapp/src/main/webapp/calc.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> - - - - -Calculator sample - - - - - - - - - - - - - - - - - - -
ExpressionResult
2 + 3<%= CalculatorServiceComponent.add(2, 3) %>
3 - 2<%= CalculatorServiceComponent.subtract(3, 2) %>
3 * 2<%= CalculatorServiceComponent.multiply(3, 2) %>
3 / 2<%= CalculatorServiceComponent.divide(3, 2) %>
- - diff --git a/java/sca/samples/calculator-ws-secure-webapp/README b/java/sca/samples/calculator-ws-secure-webapp/README deleted file mode 100644 index d0d3307b3a..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/README +++ /dev/null @@ -1,116 +0,0 @@ -Calculator Sample Exposing Secure Web Services In A WebApp -========================================================== -This sample uses the same code as the calculator sample, it deploys the -sample wrapped in a web app and exposes the AddService as a web service. -The autentication intent is applied to communications with the add -component. The integrity intent is applied to communication with the -subtract component. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-calculator-ws-secure-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-secure-webapp - -The sample is configured to use a service on port 8080. If your servlet container -is using a port other than 8080 then you will need to edit the Calculator.composite -and change the uri attribute of the used by the CalculatorServiceComponent -to use the correct port. - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite. - -calculator-webapp/ - src/ - main/ - java/ - calculator/ - AddService.java - As calculator sample - AddServiceImpl.java - CalculatorClient.java - As calculator sample - CalculatorService.java - As calculator sample - CalculatorServiceImpl.java - DivideService.java - As calculator sample - DivideServiceImpl.java - MultiplyService.java - As calculator sample - MultiplyServiceImpl.java - SubtractService.java - As calculator sample - SubtractServiceImpl.java - resources/ - Calculator.composite - As calculator sample except that the - connection between the CalculatorService - and the AddService is web services - definitions.xml - intent and polci set specification - security.properties - security configuration for the - rampart security engine that runs - inside of Axis - calculatorKeys.jks - keystore - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime and maps service - calls to the TuscanyServlet - calc.jsp - the web application that makes use of the - SCA application - - calculator.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - README - this file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd calculator-ws-secure-webapp -ant package - -This should result in a war file (sample-calculator-ws-secure-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in you -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-secure-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see the following output. - -Expression Result -2 + 3 5.0 -3 - 2 1.0 -3 * 2 6.0 -3 / 2 1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-ws-secure-webapp -mvn - -Again this should result in a war file (sample-calculator-ws-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/calculator-web.png b/java/sca/samples/calculator-ws-secure-webapp/calculator-web.png deleted file mode 100644 index f482b8d1c8..0000000000 Binary files a/java/sca/samples/calculator-ws-secure-webapp/calculator-web.png and /dev/null differ diff --git a/java/sca/samples/calculator-ws-secure-webapp/calculator-web.svg b/java/sca/samples/calculator-ws-secure-webapp/calculator-web.svg deleted file mode 100644 index 1b7015b156..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/calculator-web.svg +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - calc.jsp - - AppServer SOAP local local local - - - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/pom.xml b/java/sca/samples/calculator-ws-secure-webapp/pom.xml deleted file mode 100644 index c6d24f4806..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-ws-secure-webapp - war - Apache Tuscany SCA Calculator Sample Web Service enabled for -WS Security and in a WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the add service - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index c79c7b0395..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Service; - -/** - * An implementation of the Add service - */ -@Service(AddService.class) -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - System.err.println("********* Adding ***** " + n1 + " to " + n2); - System.err.println("Adding " + n1 + " to " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 4787b728f4..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - * - * (not really necessary as this sample runs in a webapp) - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index ad87375529..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 0f03d6e7a1..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 8c33862f6d..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index c7fbc73c00..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 8f6af2f224..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the subtract service - */ -@Remotable -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1a7f145ad8..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java deleted file mode 100644 index 9625c0d692..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ClientPWCBHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.security; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.ws.security.WSPasswordCallback; - -/** - * Sample userid passwd generation class - */ -public class ClientPWCBHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - System.out.println("*** Calling Client UserId/Password Handler .... "); - WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; - System.out.println("User Id = " + pwcb.getIdentifer()); - System.out.println("Set Password = " + pwcb.getPassword()); - System.out.println("Usage = " + pwcb.getUsage()); - if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) { - if ( pwcb.getIdentifer().equals("CalculatorUser")){ - pwcb.setPassword("CalculatorUserPasswd"); - } else { - throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); - } - } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { - if ( pwcb.getIdentifer().equals("CalculatorUser")) { - pwcb.setPassword("CalculatorUserPasswd"); - } else { - pwcb.setPassword("CalculatorAdmin"); - } - } - } - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java b/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java deleted file mode 100644 index 23a62680c5..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/java/calculator/security/ServerPWCBHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator.security; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.ws.security.WSPasswordCallback; - -/** - * Sample userid passwd generation class - */ -public class ServerPWCBHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - System.out.println("*** Calling Server User/Passwd Handler...."); - WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; - System.out.println("User Id = " + pwcb.getIdentifer()); - System.out.println("Password = " + pwcb.getPassword()); - System.out.println("Usage = " + pwcb.getUsage()); - if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) { - if ( pwcb.getIdentifer().equals("CalculatorUser") && - pwcb.getPassword().equals("CalculatorUserPasswd") ){ - return; - } else { - throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); - } - } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { - if ( pwcb.getIdentifer().equals("CalculatorUser")) { - pwcb.setPassword("CalculatorUserPasswd"); - } else { - pwcb.setPassword("CalculatorAdmin"); - } - } - } - } - -} diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite b/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite deleted file mode 100644 index 4d511f887e..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/Calculator.composite +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler deleted file mode 100644 index 858e87a34f..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures -# handler classname;qname=;model= -org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://calculator#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy -org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://calculator#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks b/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks deleted file mode 100644 index b6b244244b..0000000000 Binary files a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/calculatorKeys.jks and /dev/null differ diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml b/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml deleted file mode 100644 index 4611669bbd..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/definitions.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - - - - - - - - UsernameToken - calculator.security.ServerPWCBHandler - - - - - - - - - - UsernameToken - CalculatorUser - calculator.security.ClientPWCBHandler" + - PasswordText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CalculatorAdmin - CalculatorAdmin - calculator.security.ServerPWCBHandler - - - - JKS - calculatorKeys.jks - CalculatorAdmin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CalculatorAdmin - CalculatorAdmin - calculator.security.ClientPWCBHandler - - - - JKS - calculatorKeys.jks - CalculatorAdmin - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/security.properties b/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/security.properties deleted file mode 100644 index 8ef9928018..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/resources/security.properties +++ /dev/null @@ -1,20 +0,0 @@ -## --------------------------------------------------------------------------- -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## --------------------------------------------------------------------------- -org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin -org.apache.ws.security.crypto.merlin.keystore.type=jks -org.apache.ws.security.crypto.merlin.keystore.password=CalculatorAdmin -org.apache.ws.security.crypto.merlin.file=calculatorKeys.jks diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index fe09ab2e1b..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index d5c02e354d..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-calculator-ws-webapp - 2.0-SNAPSHOT - war - - - - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d3a62d39f4..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Calculator Web Service Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - calc.jsp - - - diff --git a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp b/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp deleted file mode 100644 index 4c4366747d..0000000000 --- a/java/sca/samples/calculator-ws-secure-webapp/src/main/webapp/calc.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> -<%@ page import="calculator.CalculatorService" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); -%> - -Calculator sample - - - - - - - - - - - - - - - - - - -
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
- - diff --git a/java/sca/samples/calculator-ws-webapp/README b/java/sca/samples/calculator-ws-webapp/README deleted file mode 100644 index a6e6c897e4..0000000000 --- a/java/sca/samples/calculator-ws-webapp/README +++ /dev/null @@ -1,108 +0,0 @@ -Calculator Sample Exposing Web Services In A WebApp -=================================================== -This sample uses the same code as the calculator sample, it deploys the -sample wrapped in a web app and exposes the AddService as a web service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-webapp - -The sample is configured to use a service on port 8080. If your servlet container -is using a port other than 8080 then you will need to edit the Calculator.composite -and change the uri attribute of the used by the CalculatorServiceComponent -to use the correct port. - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite. - -calculator-webapp/ - src/ - main/ - java/ - calculator/ - AddService.java - As calculator sample - AddServiceImpl.java - CalculatorClient.java - As calculator sample - CalculatorService.java - As calculator sample - CalculatorServiceImpl.java - DivideService.java - As calculator sample - DivideServiceImpl.java - MultiplyService.java - As calculator sample - MultiplyServiceImpl.java - SubtractService.java - As calculator sample - SubtractServiceImpl.java - resources/ - Calculator.composite - As calculator sample except that the - connection between the CalculatorService - and the AddService is web services - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime and maps service - calls to the TuscanyServlet - calc.jsp - the web application that makes use of the - SCA application - - calculator.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - README - this file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd calculator-ws-webapp -ant package - -This should result in a war file (sample-calculator-ws-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in you -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see the following output. - -Expression Result -2 + 3 5.0 -3 - 2 1.0 -3 * 2 6.0 -3 / 2 1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-ws-webapp -mvn - -Again this should result in a war file (sample-calculator-ws-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/calculator-ws-webapp/calculator-web.png b/java/sca/samples/calculator-ws-webapp/calculator-web.png deleted file mode 100644 index f482b8d1c8..0000000000 Binary files a/java/sca/samples/calculator-ws-webapp/calculator-web.png and /dev/null differ diff --git a/java/sca/samples/calculator-ws-webapp/calculator-web.svg b/java/sca/samples/calculator-ws-webapp/calculator-web.svg deleted file mode 100644 index 1b7015b156..0000000000 --- a/java/sca/samples/calculator-ws-webapp/calculator-web.svg +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - calc.jsp - - AppServer SOAP local local local - - - - diff --git a/java/sca/samples/calculator-ws-webapp/pom.xml b/java/sca/samples/calculator-ws-webapp/pom.xml deleted file mode 100644 index e0543d94a8..0000000000 --- a/java/sca/samples/calculator-ws-webapp/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator-ws-webapp - war - Apache Tuscany SCA Calculator Sample Web Service in a WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java deleted file mode 100644 index c7e6383559..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the add service - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 0af6d681ce..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Service; - -/** - * An implementation of the Add service - */ -@Service(AddService.class) -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - System.err.println("Adding " + n1 + " to " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 4787b728f4..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - * - * (not really necessary as this sample runs in a webapp) - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index ad87375529..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 0f03d6e7a1..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java deleted file mode 100644 index 835e4fda6d..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 8c33862f6d..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index db568cc762..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index c7fbc73c00..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 30e4e6a56a..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 1a7f145ad8..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator-ws-webapp/src/main/resources/Calculator.composite b/java/sca/samples/calculator-ws-webapp/src/main/resources/Calculator.composite deleted file mode 100644 index 6415d5a896..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/resources/Calculator.composite +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index fe09ab2e1b..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index 59bbb0de83..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-calculator-ws-webapp - 2.0-SNAPSHOT - war - - - - - - diff --git a/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d3a62d39f4..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Calculator Web Service Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - calc.jsp - - - diff --git a/java/sca/samples/calculator-ws-webapp/src/main/webapp/calc.jsp b/java/sca/samples/calculator-ws-webapp/src/main/webapp/calc.jsp deleted file mode 100644 index 4c4366747d..0000000000 --- a/java/sca/samples/calculator-ws-webapp/src/main/webapp/calc.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> -<%@ page import="calculator.CalculatorService" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); -%> - -Calculator sample - - - - - - - - - - - - - - - - - - -
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
- - diff --git a/java/sca/samples/calculator2/README b/java/sca/samples/calculator2/README deleted file mode 100644 index ceb532faed..0000000000 --- a/java/sca/samples/calculator2/README +++ /dev/null @@ -1,97 +0,0 @@ -Calculator Sample -================= -This sample implements a simple calculator using SCA components. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite across the local wires. - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - CalculatorServiceImpl.java - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - CalculatorClient.java - starts the SCA Runtime and - deploys the Calculator.composite. - It then calls the deployed Calculator - Components services - resources/ - Calculator.composite - the SCA assembly for this sample - test/ - java/ - calculator/ - CalculatorTestCase.java - JUnit test case - calculator.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 3 + 2=5.0 - [java] 3 - 2=1.0 - [java] 3 * 2=6.0 - [java] 3 / 2=1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.CalculatorTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/calculator2/build.xml b/java/sca/samples/calculator2/build.xml deleted file mode 100644 index c4b755ef94..0000000000 --- a/java/sca/samples/calculator2/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator2/calculator.png b/java/sca/samples/calculator2/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/java/sca/samples/calculator2/calculator.png and /dev/null differ diff --git a/java/sca/samples/calculator2/calculator.svg b/java/sca/samples/calculator2/calculator.svg deleted file mode 100644 index 0615925c50..0000000000 --- a/java/sca/samples/calculator2/calculator.svg +++ /dev/null @@ -1,329 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - diff --git a/java/sca/samples/calculator2/pom.xml b/java/sca/samples/calculator2/pom.xml deleted file mode 100644 index 1f95585cbe..0000000000 --- a/java/sca/samples/calculator2/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-calculator2 - Apache Tuscany SCA Calculator Sample - - - - - org.apache.tuscany.sca - tuscany-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-scdl4j - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-runtime2 - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/calculator2/src/main/java/calculator/AddService.java b/java/sca/samples/calculator2/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The Add service interface - */ -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/calculator2/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Add service - */ -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Adding " + n1 + " and " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorClient.java b/java/sca/samples/calculator2/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 9d180bf52e..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorClient.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package calculator; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class CalculatorClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("Calculator.composite"); - - CalculatorService calculatorService = - scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - - // Calculate - System.out.println("3 + 2=" + calculatorService.add(3, 2)); - System.out.println("3 - 2=" + calculatorService.subtract(3, 2)); - System.out.println("3 * 2=" + calculatorService.multiply(3, 2)); - System.out.println("3 / 2=" + calculatorService.divide(3, 2)); - - scaDomain.close(); - } - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorService.java b/java/sca/samples/calculator2/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 17fad7de6b..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/DivideService.java b/java/sca/samples/calculator2/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2); - return n1 / n2; - } - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/MultiplyService.java b/java/sca/samples/calculator2/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2); - return n1 * n2; - } - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/SubtractService.java b/java/sca/samples/calculator2/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/java/sca/samples/calculator2/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - Logger logger = Logger.getLogger("calculator"); - logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2); - return n1 - n2; - } - -} diff --git a/java/sca/samples/calculator2/src/main/resources/Calculator.composite b/java/sca/samples/calculator2/src/main/resources/Calculator.composite deleted file mode 100644 index 90872041b0..0000000000 --- a/java/sca/samples/calculator2/src/main/resources/Calculator.composite +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java b/java/sca/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 775ad15537..0000000000 --- a/java/sca/samples/calculator2/src/test/java/calculator/CalculatorTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorTestCase extends TestCase { - - private CalculatorService calculatorService; - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("Calculator.composite"); - calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testCalculator() throws Exception { - // Calculate - assertEquals(calculatorService.add(3, 2), 5.0); - assertEquals(calculatorService.subtract(3, 2), 1.0); - assertEquals(calculatorService.multiply(3, 2), 6.0); - assertEquals(calculatorService.divide(3, 2), 1.5); - } -} diff --git a/java/sca/samples/callback-ws-client/README b/java/sca/samples/callback-ws-client/README deleted file mode 100644 index 66121362c9..0000000000 --- a/java/sca/samples/callback-ws-client/README +++ /dev/null @@ -1,311 +0,0 @@ -Callback Web Services Client Sample -=================================== -This sample demonstrates an SCA client that sends service requests to a -remote server and receives asynchronous callbacks from the server, using -Web service bindings for the service and the callback. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look -there first. - -If you just want to run it to see what happens, you need to start the -server first, so open a command prompt and navigate to the -callback-ws-service sample directory and do: - -ant run - -OR if you don't have ant, on Windows do: - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer - -and on *nix do: - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do: - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-client.jar myapp.MyClientImpl - -and on *nix do: - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-client.jar myapp.MyClientImpl - - -Sample Overview ---------------- -The sample has a single component that has a reference with a service -interface and a callback interface, with Web service bindings for both -these interfaces. The service interface binding URI identifies the -service exposed by the callback-ws-service sample. - -callback-ws-client/ - src/ - main/ - java/ - myapp/ - MyClient.java - interface description for - MyClientComponent - MyClientImpl.java - component implementation - myserver/ - MyService.java - interface description for - MyServiceComponent - MyServiceCallback.java - interface description for callback - resources/ - myapp.composite - the SCA assembly for this sample - test/ - java/ - myapp/ - CallbackClientTestCase.java - JUnit test case - callback-ws-client.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. -Before you do this, run the callback-ws-service sample to start up the -service that the client will talk to. Take a look at the README in -that sample and you will see you need the following commands: - -cd callback-ws-service -ant run - -You can then compile and run this sample using the following commands: - -cd callback-ws-client -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 15-Jan-2008 10:21:38 org.apache.tuscany.sca.node.impl.SCADomainProxy -Impl init - [java] INFO: Domain will be started stand-alone as domain URL is not provid -ed - [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.domain.impl.SCADomainImp -l registerNode - [java] INFO: Registered node: http://L3AW203:1336 at endpoint http://L3AW20 -3:1336 - [java] 15-Jan-2008 10:21:39 org.apache.tuscany.sca.node.impl.SCADomainProxy -Impl createRuntime - [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea -se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu -bating-SNAPSHOT.jar - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainEventServi -ceProxyComponent - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomainAPIService -ProxyComponent - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo -nent/SCANodeManagerService - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo -nent/ComponentManagerService/* - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCANodeManagerCompo -nent/ComponentManagerService - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/SCADomain/scaDomain -.js - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl ac -tivateComposite - [java] INFO: Building composite: {http://myapp}myapp - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.node.impl.SCANodeImpl st -artComposite - [java] INFO: Starting composite: {http://myapp}myapp - [java] 15-Jan-2008 10:21:48 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1336/MyClientComponent/m -yService - [java] aClientMethod on thread Thread[main,5,main] - [java] aClientMethod return from someMethod on thread Thread[main,5,main] - [java] receiveResult on thread Thread[pool-1-thread-2,5,main] - [java] Result: -> someMethod -> receiveResult - [java] Closing the domain - [java] 15-Jan-2008 10:21:54 org.apache.tuscany.sca.node.impl.SCANodeImpl st -opComposite - [java] INFO: Stopping composite: {http://myapp}myapp - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and -run using Maven as follows. When using Maven you don't need to run the -callback-ws-service sample first as Maven does this for you. With Maven, -both client and server code run in the same JVM, which rather defeats the -purpose of this sample (to show a standalone SCA client), but it's good -enough for a unit test. - -cd callback-ws-client -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running myapp.CallbackClientTestCase -15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init -INFO: Domain will be started stand-alone as domain URL is not provided -15-Jan-2008 10:17:46 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo -de -INFO: Registered node: http://L3AW203:1322 at endpoint http://L3AW203:1322 -15-Jan-2008 10:17:46 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR -untime -INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw -s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO -T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar -15-Jan-2008 10:17:52 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -15-Jan-2008 10:17:53 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -1.dtd -15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -2.dtd -15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -15-Jan-2008 10:17:53 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-1322 -15-Jan-2008 10:17:53 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-1322 -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainEventServiceProxyCompo -nent -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCADomainAPIServiceProxyCompone -nt -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/SCANode -ManagerService -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone -ntManagerService/* -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCANodeManagerComponent/Compone -ntManagerService -15-Jan-2008 10:17:53 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1322/SCADomain/scaDomain.js -15-Jan-2008 10:17:53 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos -ite -INFO: Building composite: {http://callbackws}callbackws -15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite - -INFO: Starting composite: {http://callbackws}callbackws -15-Jan-2008 10:17:54 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -15-Jan-2008 10:17:54 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:17:54 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:17:54 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent -15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init -INFO: Domain will be started stand-alone as domain URL is not provided -15-Jan-2008 10:17:54 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo -de -INFO: Registered node: http://L3AW203:1323 at endpoint http://L3AW203:1323 -15-Jan-2008 10:17:54 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR -untime -INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw -s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO -T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar -15-Jan-2008 10:17:56 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -15-Jan-2008 10:17:56 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-1323 -15-Jan-2008 10:17:56 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-1323 -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainEventServiceProxyCompo -nent -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCADomainAPIServiceProxyCompone -nt -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/SCANode -ManagerService -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone -ntManagerService/* -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCANodeManagerComponent/Compone -ntManagerService -15-Jan-2008 10:17:56 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/SCADomain/scaDomain.js -15-Jan-2008 10:17:56 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos -ite -INFO: Building composite: {http://myapp}myapp -15-Jan-2008 10:17:57 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite - -INFO: Starting composite: {http://myapp}myapp -15-Jan-2008 10:17:57 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1323/MyClientComponent/myService -aClientMethod on thread Thread[main,5,main] -aClientMethod return from someMethod on thread Thread[main,5,main] -setMyServiceCallback on thread Thread[pool-1-thread-1,5,main] -someMethod on thread Thread[pool-1-thread-1,5,main] -Sleeping ... -receiveResult on thread Thread[pool-2-thread-1,5,main] -Result: -> someMethod -> receiveResult -Closing the domain -15-Jan-2008 10:18:02 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite -INFO: Stopping composite: {http://myapp}myapp -15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-1323 -15-Jan-2008 10:18:03 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite -INFO: Stopping composite: {http://callbackws}callbackws -15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:18:03 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-1322 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 17.343 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/callback-ws-client/build.xml b/java/sca/samples/callback-ws-client/build.xml deleted file mode 100644 index 8698c6018d..0000000000 --- a/java/sca/samples/callback-ws-client/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/callback-ws-client/callback-ws-client.png b/java/sca/samples/callback-ws-client/callback-ws-client.png deleted file mode 100644 index 802ef604a7..0000000000 Binary files a/java/sca/samples/callback-ws-client/callback-ws-client.png and /dev/null differ diff --git a/java/sca/samples/callback-ws-client/callback-ws-client.svg b/java/sca/samples/callback-ws-client/callback-ws-client.svg deleted file mode 100644 index f49aeadbbf..0000000000 --- a/java/sca/samples/callback-ws-client/callback-ws-client.svg +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - myapp - - MyClientComponent - - http://localhost:8086/MyServiceComponent - - myservice callback - - diff --git a/java/sca/samples/callback-ws-client/pom.xml b/java/sca/samples/callback-ws-client/pom.xml deleted file mode 100644 index 4ac9e6cf81..0000000000 --- a/java/sca/samples/callback-ws-client/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-callback-ws-client - Apache Tuscany SCA Callback Web Service Remote Client Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - org.apache.tuscany.sca - sample-callback-ws-service - 2.0-SNAPSHOT - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClient.java b/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClient.java deleted file mode 100644 index 329edbe1c8..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClient.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myapp; - -import org.oasisopen.sca.annotation.OneWay; - -/** - * The client interface - */ -public interface MyClient { - - void aClientMethod(); -} diff --git a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java b/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java deleted file mode 100644 index 4f3a3bb63b..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/java/myapp/MyClientImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myapp; - -import myserver.MyService; -import myserver.MyServiceCallback; - -import org.apache.tuscany.sca.node.SCAClient; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * Remote Web service client with callback interface - */ -@Service(MyClient.class) -@Scope("COMPOSITE") -public class MyClientImpl implements MyClient, MyServiceCallback { - @Reference - protected MyService myService; - - public void aClientMethod() { - System.out.println("aClientMethod on thread " + Thread.currentThread()); - myService.someMethod(" -> someMethod "); // calls the server - System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread()); - } - - public void receiveResult(String result) { - System.out.println("receiveResult on thread " + Thread.currentThread()); - System.out.println("Result: " + result); // callback from the server - } - - public static void main(String[] args) throws Exception { - SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("myapp.composite", MyClientImpl.class.getClassLoader()); - node.start(); - run(node); - System.out.println("Closing the domain"); - node.stop(); - } - - public static void run(SCANode node) throws InterruptedException { - MyClient myClient = ((SCAClient)node).getService(MyClient.class, "MyClientComponent"); - myClient.aClientMethod(); - Thread.sleep(5000); // don't exit before callback arrives - } -} diff --git a/java/sca/samples/callback-ws-client/src/main/java/myserver/MyService.java b/java/sca/samples/callback-ws-client/src/main/java/myserver/MyService.java deleted file mode 100644 index 9bc056318b..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/java/myserver/MyService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -/** - * The remote service that will be invoked by the client - */ -@Remotable -@Callback(MyServiceCallback.class) -public interface MyService { - - @OneWay - void someMethod(String arg); -} diff --git a/java/sca/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java b/java/sca/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java deleted file mode 100644 index caef8fcc98..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/java/myserver/MyServiceCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The callback interface for {@link MyService}. - */ -@Remotable -public interface MyServiceCallback { - - void receiveResult(String result); -} diff --git a/java/sca/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 314747d548..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/java/sca/samples/callback-ws-client/src/main/resources/myapp.composite b/java/sca/samples/callback-ws-client/src/main/resources/myapp.composite deleted file mode 100644 index 5b776d6df8..0000000000 --- a/java/sca/samples/callback-ws-client/src/main/resources/myapp.composite +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java b/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java deleted file mode 100644 index fb2f6952c4..0000000000 --- a/java/sca/samples/callback-ws-client/src/test/java/myapp/CallbackClientTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myapp; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the callback server is available - */ -public class CallbackClientTestCase { - - private SCANode node; - - @Before - public void startServer() throws Exception { - try { - node = SCANodeFactory.newInstance().createSCANodeFromClassLoader(null, getClass().getClassLoader()); - node.start(); - } catch (Exception ex) { - System.out.println(ex.toString()); - } - } - - @Test - public void testClient() throws Exception { - MyClientImpl.run(node); - } - - @After - public void stopServer() throws Exception { - node.stop(); - } -} diff --git a/java/sca/samples/callback-ws-service/README b/java/sca/samples/callback-ws-service/README deleted file mode 100644 index 2c65f745a6..0000000000 --- a/java/sca/samples/callback-ws-service/README +++ /dev/null @@ -1,227 +0,0 @@ -Callback Web Services Service Sample -=================================== -This sample demonstrates an SCA service with callback to a remote client -using Web service bindings for the service and the callback. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look -there first. - -If you just want to run it to see what happens open a command prompt, -navigate to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do: - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callback-ws-service.jar myserver.CallbackServer - -and on *nix do: - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callback-ws-service.jar myserver.CallbackServer - -Now the server is started you can use the callback-ws-client sample to -exercise it. - -Sample Overview ---------------- -The sample has a single component that provides a service that is -invoked from a remote client over Web services and makes an SCA callback -over Web services to the same remote client. - -callback-ws-service/ - src/ - main/ - java/ - myserver/ - MyService.java - interface description for - MyServiceComponent - MyServiceCallback.java - interface description for callback - NyServiceImpl.java - component implementation - CallbackServer.java - starts the SCA runtime and - deploys the callbackws.composite - and then waits for the service - to be called via Web services - resources/ - callbackws.composite - the SCA assembly for this sample - test/ - java/ - myserver/ - CallbackServerTestCase.java - JUnit test case - callback-ws-service.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant with -the following commands: - -cd callback-ws-service -ant compile -ant run - -You should see the following output from the run target: - -run: - [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy -Impl init - [java] INFO: Domain will be started stand-alone as domain URL is not provid -ed - [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.domain.impl.SCADomainImp -l registerNode - [java] INFO: Registered node: http://L3AW203:1331 at endpoint http://L3AW20 -3:1331 - [java] 15-Jan-2008 10:21:14 org.apache.tuscany.sca.node.impl.SCADomainProxy -Impl createRuntime - [java] INFO: Domain management configured from file:/C:/simon/tuscany/relea -se/sca-r1.1-rc2/tuscany-sca-1.1-incubating-SNAPSHOT/lib/tuscany-sca-all-1.1-incu -bating-SNAPSHOT.jar - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainEventServi -ceProxyComponent - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomainAPIService -ProxyComponent - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo -nent/SCANodeManagerService - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo -nent/ComponentManagerService/* - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCANodeManagerCompo -nent/ComponentManagerService - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:1331/SCADomain/scaDomain -.js - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl ac -tivateComposite - [java] INFO: Building composite: {http://callbackws}callbackws - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] Warning: Running an XSLT 1.0 stylesheet with an XSLT 2.0 processor - [java] 15-Jan-2008 10:21:24 org.apache.tuscany.sca.node.impl.SCANodeImpl st -artComposite - [java] INFO: Starting composite: {http://callbackws}callbackws - [java] 15-Jan-2008 10:21:26 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] Callback server started (press enter to shutdown) - -As this point the SCA service is exposed as a Web service by a Web server -started automatically by the SCA runtime. To stop the server, press enter. - -To exercise the service, run the callback-ws-client sample. Take a look at -the README in that sample and you will see you need the following commands: - -cd callback-ws-client -ant run - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and -run using Maven as follows. When using Maven you don't need to run the -callback-ws-client sample as the Maven build uses a simple ping test to -make sure that the service is available. - -cd callback-ws-service -mvn - -You should see the following output from the test phase: - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running myserver.CallbackServerTestCase -15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl init -INFO: Domain will be started stand-alone as domain URL is not provided -15-Jan-2008 10:29:36 org.apache.tuscany.sca.domain.impl.SCADomainImpl registerNo -de -INFO: Registered node: http://L3AW203:1365 at endpoint http://L3AW203:1365 -15-Jan-2008 10:29:36 org.apache.tuscany.sca.node.impl.SCADomainProxyImpl createR -untime -INFO: Domain management configured from file:/C:/Documents%20and%20Settings/slaw -s/.m2/repository/org/apache/tuscany/sca/tuscany-node-impl/1.1-incubating-SNAPSHO -T/tuscany-node-impl-1.1-incubating-SNAPSHOT.jar -15-Jan-2008 10:29:42 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -15-Jan-2008 10:29:42 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -1.dtd -15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -2.dtd -15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -15-Jan-2008 10:29:42 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-1365 -15-Jan-2008 10:29:42 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-1365 -15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainEventServiceProxyCompo -nent -15-Jan-2008 10:29:42 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCADomainAPIServiceProxyCompone -nt -15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/SCANode -ManagerService -15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone -ntManagerService/* -15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCANodeManagerComponent/Compone -ntManagerService -15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:1365/SCADomain/scaDomain.js -15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl activateCompos -ite -INFO: Building composite: {http://callbackws}callbackws -15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl startComposite - -INFO: Starting composite: {http://callbackws}callbackws -15-Jan-2008 10:29:43 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -15-Jan-2008 10:29:43 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:29:43 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8086/MyServiceComponent -15-Jan-2008 10:29:43 org.apache.tuscany.sca.node.impl.SCANodeImpl stopComposite -INFO: Stopping composite: {http://callbackws}callbackws -15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8086 -15-Jan-2008 10:29:43 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-1365 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.422 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/callback-ws-service/build.xml b/java/sca/samples/callback-ws-service/build.xml deleted file mode 100644 index c91dd88a8c..0000000000 --- a/java/sca/samples/callback-ws-service/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/callback-ws-service/callback-ws-service.png b/java/sca/samples/callback-ws-service/callback-ws-service.png deleted file mode 100644 index 772ac38431..0000000000 Binary files a/java/sca/samples/callback-ws-service/callback-ws-service.png and /dev/null differ diff --git a/java/sca/samples/callback-ws-service/callback-ws-service.svg b/java/sca/samples/callback-ws-service/callback-ws-service.svg deleted file mode 100644 index ff0a1d307b..0000000000 --- a/java/sca/samples/callback-ws-service/callback-ws-service.svg +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - callbackws - - MyServiceComponent - http://localhost:8086/MyServiceComponent - - myservice callback - - diff --git a/java/sca/samples/callback-ws-service/pom.xml b/java/sca/samples/callback-ws-service/pom.xml deleted file mode 100644 index e39b4480a7..0000000000 --- a/java/sca/samples/callback-ws-service/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-callback-ws-service - Apache Tuscany SCA Callback Web Service Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java b/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java deleted file mode 100644 index 75ef05bc48..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/java/myserver/CallbackServer.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import java.io.IOException; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -/** - * This server program shows how to create and start an SCA runtime that - * activates the MyService Web service endpoint. - */ -public class CallbackServer { - - public static void main(String[] args) throws Exception { - - SCANode node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); - node.start(); - - try { - System.out.println("Callback server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - node.stop(); - System.out.println("Callback server stopped"); - } - -} diff --git a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyService.java b/java/sca/samples/callback-ws-service/src/main/java/myserver/MyService.java deleted file mode 100644 index 9bc056318b..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -/** - * The remote service that will be invoked by the client - */ -@Remotable -@Callback(MyServiceCallback.class) -public interface MyService { - - @OneWay - void someMethod(String arg); -} diff --git a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java b/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java deleted file mode 100644 index caef8fcc98..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The callback interface for {@link MyService}. - */ -@Remotable -public interface MyServiceCallback { - - void receiveResult(String result); -} diff --git a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java b/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java deleted file mode 100644 index 98833338f0..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/java/myserver/MyServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements MyService and uses a callback. - */ -@Service(MyService.class) -@Scope("COMPOSITE") -public class MyServiceImpl implements MyService { - - private MyServiceCallback myServiceCallback; - - /** - * The setter used by the runtime to set the callback reference - * @param myServiceCallback - */ - @Callback - public void setMyServiceCallback(MyServiceCallback myServiceCallback) { - System.out.println("setMyServiceCallback on thread " + Thread.currentThread()); - this.myServiceCallback = myServiceCallback; - } - - public void someMethod(String arg) { - System.out.println("someMethod on thread " + Thread.currentThread()); - // invoke the callback - try { - System.out.println("Sleeping ..."); - Thread.sleep(2000); - myServiceCallback.receiveResult(arg + " -> receiveResult "); - } catch(Exception e) { - System.out.println("RuntimeException invoking receiveResult: " + e.toString()); - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 35f7f60c2e..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - diff --git a/java/sca/samples/callback-ws-service/src/main/resources/callbackws.composite b/java/sca/samples/callback-ws-service/src/main/resources/callbackws.composite deleted file mode 100644 index a09e638896..0000000000 --- a/java/sca/samples/callback-ws-service/src/main/resources/callbackws.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java b/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java deleted file mode 100644 index e87667cc3e..0000000000 --- a/java/sca/samples/callback-ws-service/src/test/java/myserver/CallbackServerTestCase.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package myserver; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the callback server is available - */ -public class CallbackServerTestCase { - - private SCANode node; - - @Before - public void startServer() throws Exception { - node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("callbackws.composite", null); - node.start(); - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8086); - } - - @After - public void stopServer() throws Exception { - node.stop(); - } -} diff --git a/java/sca/samples/callbacks-jms/README b/java/sca/samples/callbacks-jms/README deleted file mode 100644 index b5e130e2fc..0000000000 --- a/java/sca/samples/callbacks-jms/README +++ /dev/null @@ -1,73 +0,0 @@ -Callback JMS Sample -=================== -This sample demonstrates SCA callbacks over the JMS binding. It implements the example -described in the INFOQ article: - - "Can I call you back about that?" Building Asynchronous Services using Service Component Architecture - See: http://www.infoq.com/articles/async-sca - -It implements a service for placing an order for some widgets, where the service is asynchronous -and the client is informed of progress via a callback interface. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-callbacks-jms.jar callbacks.CallbacksTestCase - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-callbacks-jms.jar callbacks.CallbacksTestCase - -Sample Overview ---------------- - -The only changes over the sample code described in the INFOQ article are to add the @Remotable annotation -to the service and callback interfaces, add the @Oneway annotation to the placeOrder and placeOrderResponse -methods, and the composite XML is changed to use instead of . - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd callbacks-jms -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] client placing order: callbacks.OrderRequest@c72243 - [java] service received order: callbacks.OrderRequest@1f94884 - [java] client callback received order response: callbacks.OrderResponse@14ab51b - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd callbacks-jms -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running callbacks.CallbacksTestCase -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.272 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/callbacks-jms/build.xml b/java/sca/samples/callbacks-jms/build.xml deleted file mode 100644 index 665feeca71..0000000000 --- a/java/sca/samples/callbacks-jms/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/callbacks-jms/pom.xml b/java/sca/samples/callbacks-jms/pom.xml deleted file mode 100644 index d7bef36033..0000000000 --- a/java/sca/samples/callbacks-jms/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-callbacks-jms - Apache Tuscany SCA Callbacks with JMS Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jms-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - org.apache.activemq - activemq-core - 5.1.0 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java deleted file mode 100644 index 12533ff610..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface OrderCallback { - - @OneWay - public void placeOrderResponse(OrderResponse orderResponse); -} diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java deleted file mode 100644 index 69f5751379..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderRequest.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -public class OrderRequest { - -} diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java deleted file mode 100644 index 882bcf8479..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -public class OrderResponse { - -} diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderService.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderService.java deleted file mode 100644 index d0161b1498..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -@Callback(OrderCallback.class) -public interface OrderService { - - @OneWay - public void placeOrder(OrderRequest orderRequest); - -} diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java deleted file mode 100644 index 757fe3ae41..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -@Service(OrderServiceClient.class) -public class OrderServiceClient implements OrderCallback { - - // A field to hold the reference to the order service - - private OrderService orderService; - public static OrderResponse oResponse; - - public void doSomeOrdering() { - - OrderRequest oRequest = new OrderRequest(); - - // … fill in the details of the order … - - System.out.println("client placing order: " + oRequest); - - orderService.placeOrder(oRequest); - - // …the client code can continue to do processing - } - - public void placeOrderResponse(OrderResponse oResponse) { - - // …handle the response as needed - - System.out.println("client callback received order response: " + oResponse); - OrderServiceClient.oResponse = oResponse; - } - - // A setter method for the order service reference - @Reference - public void setOrderService(OrderService theService) { - orderService = theService; - } -} diff --git a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java b/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java deleted file mode 100644 index 9de7307391..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/java/callbacks/OrderServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package callbacks; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Service; - -@Service(OrderService.class) -public class OrderServiceImpl implements OrderService { - - // A field for the callback reference object - private OrderCallback callbackReference; - - // The place order operation itself - public void placeOrder(OrderRequest oRequest) { - - // …do the work to process the order… - // …which may take some time… - - System.out.println("service received order: " + oRequest); - - // when ready to respond… - - OrderResponse theResponse = new OrderResponse(); - - callbackReference.placeOrderResponse(theResponse); - } - - // A setter method for the callback reference - @Callback - public void setCallbackReference(OrderCallback theCallback) { - callbackReference = theCallback; - } -} diff --git a/java/sca/samples/callbacks-jms/src/main/resources/callbacks.composite b/java/sca/samples/callbacks-jms/src/main/resources/callbacks.composite deleted file mode 100644 index 94dd29c45d..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/resources/callbacks.composite +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/callbacks-jms/src/main/resources/jndi.properties b/java/sca/samples/callbacks-jms/src/main/resources/jndi.properties deleted file mode 100644 index 698aeb1711..0000000000 --- a/java/sca/samples/callbacks-jms/src/main/resources/jndi.properties +++ /dev/null @@ -1,30 +0,0 @@ -## --------------------------------------------------------------------------- -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You under the Apache License, Version 2.0 -## (the "License"); you may not use this file except in compliance with -## the License. You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## --------------------------------------------------------------------------- - -# START SNIPPET: jndi - -java.naming.factory.initial = org.apache.activemq.jndi.ActiveMQInitialContextFactory - -# use the following property to configure the default connector -java.naming.provider.url = vm://localhost?broker.persistent=false&broker.useJmx=false - -# use the following property to specify the JNDI name the connection factory should appear as. -connectionFactoryNames = ConnectionFactory - -# register some queues in JNDI using the form -# queue.[jndiName] = [physicalName] -queue.OrderService = OrderServiceQueue diff --git a/java/sca/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java b/java/sca/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java deleted file mode 100644 index 967fc42c64..0000000000 --- a/java/sca/samples/callbacks-jms/src/test/java/callbacks/CallbacksTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package callbacks; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This shows how to test the Calculator service component. - */ -public class CallbacksTestCase extends TestCase { - - private OrderServiceClient orderServiceClient; - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("callbacks.composite"); - orderServiceClient = scaDomain.getService(OrderServiceClient.class, "ClientComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testOderClient() throws Exception { - - orderServiceClient.doSomeOrdering(); - - // wait to give the service time to respond - Thread.sleep(500); - } - - public static void main(String[] args) { - try { - - CallbacksTestCase runner = new CallbacksTestCase(); - runner.setUp(); - runner.testOderClient(); - runner.tearDown(); - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/chat-webapp/README b/java/sca/samples/chat-webapp/README deleted file mode 100644 index 09b9c6f6be..0000000000 --- a/java/sca/samples/chat-webapp/README +++ /dev/null @@ -1,83 +0,0 @@ -Chat WebApp Sample -================== -This sample demonstrates the SCA DWR binding to implement the classic Ajax sample -of a chat application which allows multiple users to chat from their browsers. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-chat-webapp.war) -to your web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-chat-webapp - -The port and hostname will of course vary depending on your local installation. - -Sample Overview ---------------- -The sample provides an SCA component which has an SCA service using the SCA DWR -binding and an SCA reference also using the DWR binding. The component implementation -simply forwards every invocation of the service as an invocation on the reference. The -component reference is scoped by the composite so every active client of the composite -will receive every message sent to the component service, thus implementing the chat -application with very little code. - -chat-webapp/ - src/ - main/ - java/ - sample/ - ChatService.java - service interface - ChatServiceImpl.java - service implementation - resources/ - chat.composite - the SCA assembly for this sample - webapp - chat.html - the html UserInterface for this application - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd chat-webapp -ant package - -This should result in a war file (sample-chat-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in you -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-chat-webapp - -The port and hostname will of course vary depending on your local installation. - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd chat-webapp -mvn - -Again this should result in a war file (sample-chat-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/chat-webapp/chat-webapp.png b/java/sca/samples/chat-webapp/chat-webapp.png deleted file mode 100644 index fdf540d243..0000000000 Binary files a/java/sca/samples/chat-webapp/chat-webapp.png and /dev/null differ diff --git a/java/sca/samples/chat-webapp/chat-webapp.svg b/java/sca/samples/chat-webapp/chat-webapp.svg deleted file mode 100644 index b37c1dc590..0000000000 --- a/java/sca/samples/chat-webapp/chat-webapp.svg +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - store - - - DWR - - - DWR - - Catalog - - - diff --git a/java/sca/samples/chat-webapp/pom.xml b/java/sca/samples/chat-webapp/pom.xml deleted file mode 100644 index 93fa269cf4..0000000000 --- a/java/sca/samples/chat-webapp/pom.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-chat-webapp - war - Apache Tuscany SCA Chat Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-dwr - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - - diff --git a/java/sca/samples/chat-webapp/src/main/java/sample/ChatService.java b/java/sca/samples/chat-webapp/src/main/java/sample/ChatService.java deleted file mode 100644 index bf34675b8a..0000000000 --- a/java/sca/samples/chat-webapp/src/main/java/sample/ChatService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface ChatService { - - public void chat(String msg); - -} diff --git a/java/sca/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java b/java/sca/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java deleted file mode 100644 index f0725dd60c..0000000000 --- a/java/sca/samples/chat-webapp/src/main/java/sample/ChatServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class ChatServiceImpl implements ChatService { - - ChatService chatters; - - public void chat(String msg) { - chatters.chat(msg); - } - - public void setChatters(ChatService chatters) { - this.chatters = chatters; - } -} diff --git a/java/sca/samples/chat-webapp/src/main/resources/chat.composite b/java/sca/samples/chat-webapp/src/main/resources/chat.composite deleted file mode 100644 index c9ce95e2dc..0000000000 --- a/java/sca/samples/chat-webapp/src/main/resources/chat.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 897849ff8d..0000000000 --- a/java/sca/samples/chat-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 97d91fec56..0000000000 --- a/java/sca/samples/chat-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Apache Tuscany AJAX/DWR Chat Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - chat.html - - - diff --git a/java/sca/samples/chat-webapp/src/main/webapp/chat.html b/java/sca/samples/chat-webapp/src/main/webapp/chat.html deleted file mode 100644 index 7a449a906a..0000000000 --- a/java/sca/samples/chat-webapp/src/main/webapp/chat.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - Apache Tuscany Ajax/DWR Chat Sample - - - - - - - - -

Apache Tuscany Ajax/DWR Chat Sample

- - A simple client to chat between multiple web browsers:

- - Nickname: -

- - Enter text: - - -

-
- - - diff --git a/java/sca/samples/chat2-webapp/README b/java/sca/samples/chat2-webapp/README deleted file mode 100644 index 0186006211..0000000000 --- a/java/sca/samples/chat2-webapp/README +++ /dev/null @@ -1,61 +0,0 @@ -Chat WebApp Sample -================== -This sample demonstrates the SCA DWR binding to implement the classic Ajax sample -of a chat application which allows multiple users to chat from their browsers. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-chat-webapp.war) -to your web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-chat-webapp - -The port and hostname will of course vary depending on your local installation. - -Sample Overview ---------------- -The sample provides an SCA component which has an SCA service using the SCA DWR -binding and an SCA reference also using the DWR binding. The component implementation -simply forwards every invocation of the service as an invocation on the reference. The -component reference is scoped by the composite so every active client of the composite -will receive every message sent to the component service, thus implementing the chat -application with very little code. - -chat-webapp/ - src/ - main/ - java/ - sample/ - ChatService.java - service interface - ChatServiceImpl.java - service implementation - resources/ - chat.composite - the SCA assembly for this sample - webapp - chat.html - the html UserInterface for this application - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - - pom.xml - the Maven build file - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd chat-webapp -mvn - -Again this should result in a war file (sample-chat-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/chat2-webapp/build.xml b/java/sca/samples/chat2-webapp/build.xml deleted file mode 100644 index 2d3fc0c5f3..0000000000 --- a/java/sca/samples/chat2-webapp/build.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/chat2-webapp/pom.xml b/java/sca/samples/chat2-webapp/pom.xml deleted file mode 100644 index e35891561b..0000000000 --- a/java/sca/samples/chat2-webapp/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-chat2-webapp - war - Apache Tuscany SCA Chat Sample WebApp using callbacks - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-dwr - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-web - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - - diff --git a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatCallback.java b/java/sca/samples/chat2-webapp/src/main/java/sample/ChatCallback.java deleted file mode 100644 index 261eb12124..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatCallback.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface ChatCallback { - void newMsg(String msg); -} diff --git a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatService.java b/java/sca/samples/chat2-webapp/src/main/java/sample/ChatService.java deleted file mode 100644 index a5aff8f316..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatService.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package sample; - -import javax.jws.Oneway; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Remotable; -import org.oasisopen.sca.annotation.Scope; - -@Remotable -@Scope("COMPOSITE") -@Callback(ChatCallback.class) -public interface ChatService { - - @Oneway - public void addMsg(String msg); -} diff --git a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java b/java/sca/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java deleted file mode 100644 index fd22fb70e8..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/java/sample/ChatServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.oasisopen.sca.annotation.Callback; - -public class ChatServiceImpl implements ChatService { - - ChatCallback chatCallback; - - @Callback - public void setCallback(ChatCallback chatCallback) { - this.chatCallback = chatCallback; - } - - public void addMsg(String msg) { - chatCallback.newMsg(msg); - } -} diff --git a/java/sca/samples/chat2-webapp/src/main/resources/chat.composite b/java/sca/samples/chat2-webapp/src/main/resources/chat.composite deleted file mode 100644 index 93a10d0fdf..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/resources/chat.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 897849ff8d..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 6919372e87..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - Apache Tuscany AJAX/DWR Chat Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - chat.jsp - - - diff --git a/java/sca/samples/chat2-webapp/src/main/webapp/chat.html b/java/sca/samples/chat2-webapp/src/main/webapp/chat.html deleted file mode 100644 index a063e27f8e..0000000000 --- a/java/sca/samples/chat2-webapp/src/main/webapp/chat.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - Apache Tuscany Ajax/DWR Chat Sample - - - - - - -

Apache Tuscany Ajax/DWR Chat Sample

- - A simple client to chat between multiple web browsers:

- - Nickname: -

- - Enter text: - - -

-
- - - diff --git a/java/sca/samples/customer-dojo-webapp/README b/java/sca/samples/customer-dojo-webapp/README deleted file mode 100644 index 9c1729123f..0000000000 --- a/java/sca/samples/customer-dojo-webapp/README +++ /dev/null @@ -1,104 +0,0 @@ -Customer Dojo RPC Sample -=========================== - -Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 - -This sample demostrates the SCA JSONRPC binding using a simple web app that -uses the RPC support of the Dojo Toolkit to an SCA service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding -but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. - -Sample Overview ---------------- -The sample provides a single service with an operation that reflects -a greeting back to the caller. The service is exposed using the JSONRPC -binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be -used to invoke the SCA service. - -The web app provided shows how the service can be called by using the DOJO toolkit. - -helloworld-dojo-webapp/ - build-dojo.xml - This file is an Ant script used by the - sample build process to download the Dojo Toolkit - and get it included in the WAR file - for use by the sample. - src/ - main/ - java/ - helloworldjsonrpc/ - HelloWorldService.java - service interface - HelloWorldServiceImpl.java - service implementation - resources/ - jsonrpc.composite - the SCA assembly for this sample - webapp - dojo/ - the Dojo toolkit (this directory is created only - when you build the samples from the source distribution) - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - HelloWorldJSONRPC.html - the web application that calls the - SCA service via JSONRPC - style.css - style sheet - - helloworld-jsonrpc-webapp.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file that unpacks the - dojo installation - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd helloworld-dojo-webapp -ant package - -This should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in your -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see a web page that allows you to send messages, via JSONRPC, to the -application running in the Tuscany SCA Runtime - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd helloworld-dojo-webapp -mvn - -Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/customer-dojo-webapp/build-dojo.xml b/java/sca/samples/customer-dojo-webapp/build-dojo.xml deleted file mode 100644 index 534a1dacd9..0000000000 --- a/java/sca/samples/customer-dojo-webapp/build-dojo.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/build.xml b/java/sca/samples/customer-dojo-webapp/build.xml deleted file mode 100644 index 95813af65a..0000000000 --- a/java/sca/samples/customer-dojo-webapp/build.xml +++ /dev/null @@ -1,70 +0,0 @@ - - -]> - - - - &buildDependency; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png deleted file mode 100644 index 57f90aed01..0000000000 Binary files a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png and /dev/null differ diff --git a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg deleted file mode 100644 index d5c3bc5d3e..0000000000 --- a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldjsonrpc - - HelloWorldJSONServiceComponent - HelloWorldService - WebApp - DOJO - - diff --git a/java/sca/samples/customer-dojo-webapp/customer.sql b/java/sca/samples/customer-dojo-webapp/customer.sql deleted file mode 100644 index a3caf8e050..0000000000 --- a/java/sca/samples/customer-dojo-webapp/customer.sql +++ /dev/null @@ -1,33 +0,0 @@ --- --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, --- software distributed under the License is distributed on an --- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --- KIND, either express or implied. See the License for the --- specific language governing permissions and limitations --- under the License. --- - -DROP TABLE CUSTOMER; - -CREATE TABLE CUSTOMER ( - ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, - NAME VARCHAR(30), - PHONE VARCHAR(10), - ADDRESS VARCHAR(25), - CITY VARCHAR(15), - STATE VARCHAR(2), - ZIP VARCHAR(5)); - -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Joe Smith', '4081234567', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Erik Johnson', '4081230987', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Mark Pensacola', '4085679988', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/pom.xml b/java/sca/samples/customer-dojo-webapp/pom.xml deleted file mode 100644 index 2474a561fb..0000000000 --- a/java/sca/samples/customer-dojo-webapp/pom.xml +++ /dev/null @@ -1,232 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-customer-dojo-webapp - war - Apache Tuscany SCA Customer DOJO Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.geronimo.specs - geronimo-jpa_3.0_spec - 1.1 - - - - org.apache.openjpa - openjpa - 1.0.0 - - - javax.xml.bind - jaxb-api - - - - - - org.apache.derby - derby - 10.3.1.4 - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-antrun-plugin - - - - ant - ant-trax - 1.6.5 - - - - - install-dojo - validate - - run - - - - - - - - - - - copy-dojo-files - generate-resources - - run - - - - - - - - - - - - clean-dojo-files - clean - - run - - - - - - - - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - true - - - generate - - - - - - org.codehaus.mojo - sql-maven-plugin - 1.3 - - - - org.apache.derby - derby - 10.3.1.4 - - - - - - create-db - generate-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/customer-db;create=true - true - continue - skip - ; - - ${pom.basedir}/customer.sql - - - - - - - shutdown-database-sothat-test-can-run - process-test-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/customer-db;shutdown=true - true - - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java deleted file mode 100644 index 6d207ea2ef..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import javax.persistence.Basic; -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Customer { - - @Id protected int id; - @Basic protected String name; - @Basic protected String phone; - @Basic protected String address; - @Basic protected String city; - @Basic protected String state; - @Basic protected String zip; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZip() { - return zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java deleted file mode 100644 index 5ad39aad5c..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package customer; - -import org.apache.tuscany.sca.data.collection.Collection; - - -public interface CustomerCollection extends Collection { - -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java deleted file mode 100644 index c0a2f25f15..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package customer; - -import java.util.Iterator; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; - - -public class CustomerCollectionImpl implements CustomerCollection { - EntityManagerFactory emf = null; - EntityManager em = null; - - public CustomerCollectionImpl() { - System.out.println(">>>"); - try { - emf = Persistence.createEntityManagerFactory("customer-openJPA"); - em = emf.createEntityManager(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void delete(String arg0) throws NotFoundException { - // TODO Auto-generated method stub - - } - - public Customer get(String arg0) throws NotFoundException { - // TODO Auto-generated method stub - return null; - } - - public Entry[] getAll() { - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - Customer customer = (Customer)iter.next(); - - System.out.println(customer); - } - - tx.commit(); - } catch(Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - return null; - } - - public String post(String arg0, Customer arg1) { - // TODO Auto-generated method stub - return null; - } - - public void put(String arg0, Customer arg1) throws NotFoundException { - // TODO Auto-generated method stub - - } - - public Entry[] query(String arg0) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java deleted file mode 100644 index b3c965f1f7..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CustomerService { - - Customer[] get(); - - Customer findCustomerByName(String name); - -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java deleted file mode 100644 index 2bd49e2cf1..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.oasisopen.sca.annotation.Destroy; -import org.oasisopen.sca.annotation.Init; - -public class CustomerServiceImpl implements CustomerService { - EntityManagerFactory emf = null; - EntityManager em = null; - - public CustomerServiceImpl() { - - } - - @Init - public void init() { - System.out.println(">>> Initializing JPA"); - try { - emf = Persistence.createEntityManagerFactory("customer-openJPA"); - em = emf.createEntityManager(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Destroy - public void destroy() { - emf.close(); - } - - public Customer[] get() { - EntityTransaction tx = em.getTransaction(); - List customers = new ArrayList(); - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - Customer customer = (Customer)iter.next(); - customers.add(customer); - } - - tx.commit(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - Customer[] customerArray = new Customer[customers.size()]; - customers.toArray(customerArray); - return customerArray; - } - - public Customer findCustomerByName(String name) { - EntityTransaction tx = em.getTransaction(); - Customer customer = null; - - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c WHERE c.name = '" + name + "'"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - customer = (Customer)iter.next(); - } - - tx.commit(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - return customer; - } - -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java b/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java deleted file mode 100644 index d7f88b8dd4..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class Launch { - public static void main(String[] args) throws Exception { - System.out.println("Starting ..."); - SCADomain scaDomain = SCADomain.newInstance("customer.composite"); - System.out.println("store.composite ready for big business !!!"); - System.in.read(); - System.out.println("Stopping ..."); - scaDomain.close(); - System.out.println(); - } -} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml deleted file mode 100644 index 64be295302..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 5674dede06..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - orm.xml - customer.Customer - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 136326d1d3..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite b/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite deleted file mode 100644 index 8b8a413499..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 32f11ab9d0..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index 3e72bf29a4..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-customer-dojo-webapp - 2.0-SNAPSHOT - war - - - - - - diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d90b4a7d62..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Customer dojo web application sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - customer.jsp - - - diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp b/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp deleted file mode 100644 index f7e864053e..0000000000 --- a/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp +++ /dev/null @@ -1,80 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> - - - - Tuscany Dojo JSON-RPC Customer Example - - - - - - - - - - - - - - - -

Tuscany Dojo JSON-RPC Customer Sample

- -Customer Name :
- - - - - - - - diff --git a/java/sca/samples/customer-dojo/README b/java/sca/samples/customer-dojo/README deleted file mode 100644 index 9c1729123f..0000000000 --- a/java/sca/samples/customer-dojo/README +++ /dev/null @@ -1,104 +0,0 @@ -Customer Dojo RPC Sample -=========================== - -Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 - -This sample demostrates the SCA JSONRPC binding using a simple web app that -uses the RPC support of the Dojo Toolkit to an SCA service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding -but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. - -Sample Overview ---------------- -The sample provides a single service with an operation that reflects -a greeting back to the caller. The service is exposed using the JSONRPC -binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be -used to invoke the SCA service. - -The web app provided shows how the service can be called by using the DOJO toolkit. - -helloworld-dojo-webapp/ - build-dojo.xml - This file is an Ant script used by the - sample build process to download the Dojo Toolkit - and get it included in the WAR file - for use by the sample. - src/ - main/ - java/ - helloworldjsonrpc/ - HelloWorldService.java - service interface - HelloWorldServiceImpl.java - service implementation - resources/ - jsonrpc.composite - the SCA assembly for this sample - webapp - dojo/ - the Dojo toolkit (this directory is created only - when you build the samples from the source distribution) - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - HelloWorldJSONRPC.html - the web application that calls the - SCA service via JSONRPC - style.css - style sheet - - helloworld-jsonrpc-webapp.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file that unpacks the - dojo installation - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd helloworld-dojo-webapp -ant package - -This should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in your -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see a web page that allows you to send messages, via JSONRPC, to the -application running in the Tuscany SCA Runtime - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd helloworld-dojo-webapp -mvn - -Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/customer-dojo/build-dojo.xml b/java/sca/samples/customer-dojo/build-dojo.xml deleted file mode 100644 index 8c6bd99484..0000000000 --- a/java/sca/samples/customer-dojo/build-dojo.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/customer-dojo/build.xml b/java/sca/samples/customer-dojo/build.xml deleted file mode 100644 index 95813af65a..0000000000 --- a/java/sca/samples/customer-dojo/build.xml +++ /dev/null @@ -1,70 +0,0 @@ - - -]> - - - - &buildDependency; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.png b/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.png deleted file mode 100644 index 57f90aed01..0000000000 Binary files a/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.png and /dev/null differ diff --git a/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.svg b/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.svg deleted file mode 100644 index d5c3bc5d3e..0000000000 --- a/java/sca/samples/customer-dojo/customer-dojo-jsonrpc.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldjsonrpc - - HelloWorldJSONServiceComponent - HelloWorldService - WebApp - DOJO - - diff --git a/java/sca/samples/customer-dojo/customer.sql b/java/sca/samples/customer-dojo/customer.sql deleted file mode 100644 index a3caf8e050..0000000000 --- a/java/sca/samples/customer-dojo/customer.sql +++ /dev/null @@ -1,33 +0,0 @@ --- --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, --- software distributed under the License is distributed on an --- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY --- KIND, either express or implied. See the License for the --- specific language governing permissions and limitations --- under the License. --- - -DROP TABLE CUSTOMER; - -CREATE TABLE CUSTOMER ( - ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, - NAME VARCHAR(30), - PHONE VARCHAR(10), - ADDRESS VARCHAR(25), - CITY VARCHAR(15), - STATE VARCHAR(2), - ZIP VARCHAR(5)); - -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Joe Smith', '4081234567', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Erik Johnson', '4081230987', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); -INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Mark Pensacola', '4085679988', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); \ No newline at end of file diff --git a/java/sca/samples/customer-dojo/pom.xml b/java/sca/samples/customer-dojo/pom.xml deleted file mode 100644 index 5c64caaad4..0000000000 --- a/java/sca/samples/customer-dojo/pom.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-customer-dojo - Apache Tuscany SCA Customer DOJO Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - - - - org.apache.geronimo.specs - geronimo-jpa_3.0_spec - 1.1 - - - - org.apache.openjpa - openjpa - 1.0.0 - - - javax.xml.bind - jaxb-api - - - - - - org.apache.derby - derby - 10.3.1.4 - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-antrun-plugin - - - - ant - ant-trax - 1.6.5 - - - - - install-dojo - validate - - run - - - - - - - - - - - copy-dojo-files - generate-resources - - run - - - - - - - - - - - - clean-dojo-files - clean - - run - - - - - - - - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - true - - - generate - - - - - - org.codehaus.mojo - sql-maven-plugin - 1.3 - - - - org.apache.derby - derby - 10.3.1.4 - - - - - - create-db - generate-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/customer-db;create=true - true - continue - skip - ; - - ${pom.basedir}/customer.sql - - - - - - - shutdown-database-sothat-test-can-run - process-test-resources - - execute - - - org.apache.derby.jdbc.EmbeddedDriver - jdbc:derby:${pom.basedir}/target/classes/customer-db;shutdown=true - true - - - - - - - diff --git a/java/sca/samples/customer-dojo/src/main/java/customer/Customer.java b/java/sca/samples/customer-dojo/src/main/java/customer/Customer.java deleted file mode 100644 index 6d207ea2ef..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/customer/Customer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import javax.persistence.Basic; -import javax.persistence.Entity; -import javax.persistence.Id; - -@Entity -public class Customer { - - @Id protected int id; - @Basic protected String name; - @Basic protected String phone; - @Basic protected String address; - @Basic protected String city; - @Basic protected String state; - @Basic protected String zip; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - public String getCity() { - return city; - } - - public void setCity(String city) { - this.city = city; - } - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public String getZip() { - return zip; - } - - public void setZip(String zip) { - this.zip = zip; - } - -} diff --git a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollection.java b/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollection.java deleted file mode 100644 index 5ad39aad5c..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollection.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package customer; - -import org.apache.tuscany.sca.data.collection.Collection; - - -public interface CustomerCollection extends Collection { - -} diff --git a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java b/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java deleted file mode 100644 index c0a2f25f15..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerCollectionImpl.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package customer; - -import java.util.Iterator; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; - - -public class CustomerCollectionImpl implements CustomerCollection { - EntityManagerFactory emf = null; - EntityManager em = null; - - public CustomerCollectionImpl() { - System.out.println(">>>"); - try { - emf = Persistence.createEntityManagerFactory("customer-openJPA"); - em = emf.createEntityManager(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void delete(String arg0) throws NotFoundException { - // TODO Auto-generated method stub - - } - - public Customer get(String arg0) throws NotFoundException { - // TODO Auto-generated method stub - return null; - } - - public Entry[] getAll() { - EntityTransaction tx = em.getTransaction(); - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - Customer customer = (Customer)iter.next(); - - System.out.println(customer); - } - - tx.commit(); - } catch(Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - return null; - } - - public String post(String arg0, Customer arg1) { - // TODO Auto-generated method stub - return null; - } - - public void put(String arg0, Customer arg1) throws NotFoundException { - // TODO Auto-generated method stub - - } - - public Entry[] query(String arg0) { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerService.java b/java/sca/samples/customer-dojo/src/main/java/customer/CustomerService.java deleted file mode 100644 index b3c965f1f7..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CustomerService { - - Customer[] get(); - - Customer findCustomerByName(String name); - -} diff --git a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java b/java/sca/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java deleted file mode 100644 index 2bd49e2cf1..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/customer/CustomerServiceImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package customer; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityTransaction; -import javax.persistence.Persistence; -import javax.persistence.Query; - -import org.oasisopen.sca.annotation.Destroy; -import org.oasisopen.sca.annotation.Init; - -public class CustomerServiceImpl implements CustomerService { - EntityManagerFactory emf = null; - EntityManager em = null; - - public CustomerServiceImpl() { - - } - - @Init - public void init() { - System.out.println(">>> Initializing JPA"); - try { - emf = Persistence.createEntityManagerFactory("customer-openJPA"); - em = emf.createEntityManager(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Destroy - public void destroy() { - emf.close(); - } - - public Customer[] get() { - EntityTransaction tx = em.getTransaction(); - List customers = new ArrayList(); - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - Customer customer = (Customer)iter.next(); - customers.add(customer); - } - - tx.commit(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - Customer[] customerArray = new Customer[customers.size()]; - customers.toArray(customerArray); - return customerArray; - } - - public Customer findCustomerByName(String name) { - EntityTransaction tx = em.getTransaction(); - Customer customer = null; - - try { - tx.begin(); - - Query q = em.createQuery("SELECT c FROM customer c WHERE c.name = '" + name + "'"); - List results = q.getResultList(); - Iterator iter = results.iterator(); - while (iter.hasNext()) { - customer = (Customer)iter.next(); - } - - tx.commit(); - } catch (Exception e) { - e.printStackTrace(); - } finally { - if (tx.isActive()) { - tx.rollback(); - } - - em.close(); - } - - return customer; - } - -} diff --git a/java/sca/samples/customer-dojo/src/main/java/launch/Launch.java b/java/sca/samples/customer-dojo/src/main/java/launch/Launch.java deleted file mode 100644 index a51ab605bc..0000000000 --- a/java/sca/samples/customer-dojo/src/main/java/launch/Launch.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class Launch { - public static void main(String[] args) throws Exception { - System.out.println("Starting ..."); - SCADomain scaDomain = SCADomain.newInstance("customer.composite"); - System.out.println("customer.composite ready for big business !!!"); - System.out.println("url : http://localhost:8080/customer.html"); - System.in.read(); - System.out.println("Stopping ..."); - scaDomain.close(); - System.out.println(); - } -} diff --git a/java/sca/samples/customer-dojo/src/main/resources/META-INF/orm.xml b/java/sca/samples/customer-dojo/src/main/resources/META-INF/orm.xml deleted file mode 100644 index 64be295302..0000000000 --- a/java/sca/samples/customer-dojo/src/main/resources/META-INF/orm.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/customer-dojo/src/main/resources/META-INF/persistence.xml b/java/sca/samples/customer-dojo/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 5add897279..0000000000 --- a/java/sca/samples/customer-dojo/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - orm.xml - customer.Customer - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index 136326d1d3..0000000000 --- a/java/sca/samples/customer-dojo/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/customer-dojo/src/main/resources/content/customer.html b/java/sca/samples/customer-dojo/src/main/resources/content/customer.html deleted file mode 100644 index dbc8aad9d0..0000000000 --- a/java/sca/samples/customer-dojo/src/main/resources/content/customer.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - Tuscany Dojo JSON-RPC Customer Example - - - - - - - - - - - - - - - -

Tuscany Dojo JSON-RPC Customer Sample

- -Customer Name :
- - - - - - - - diff --git a/java/sca/samples/customer-dojo/src/main/resources/customer.composite b/java/sca/samples/customer-dojo/src/main/resources/customer.composite deleted file mode 100644 index 4c370f2a9f..0000000000 --- a/java/sca/samples/customer-dojo/src/main/resources/customer.composite +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/databinding-echo/README b/java/sca/samples/databinding-echo/README deleted file mode 100644 index 67c1aa32d5..0000000000 --- a/java/sca/samples/databinding-echo/README +++ /dev/null @@ -1,143 +0,0 @@ -DataBinding Echo Sample -======================= - -This sample demonstrates how databindings are used to convert data formats as -the data flows between components. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens, open a command prompt, navigate -to this sample directory, and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;..\binding-echo-extension\target\sample-binding-echo-extension.jar;target\sample-databinding-echo.jar dbecho.EchoDataBindingClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:../binding-echo-extension/target/sample-binding-echo-extension.jar:target/sample-databinding-echo.jar dbecho.EchoDataBindingClient - - -Sample Overview ---------------- -If reference and service interfaces are the same in all but the formats of -data being passed to and returned from the operations of the interfaces, -then SCA will try to apply appropriate transformations to the data formats -to allow messages to pass. - -This sample shows this happening. ComponentA implements Interface1 which -defines; - - String call(String msg) - String call1(String msg) - -ComponentA defines a reference to ComponentB with Interface1. ComponentB -however implements Interface2 which defines; - - Node call(Node msg); - XMLStreamReader call1(XMLStreamReader msg); - -You can see from the test output below that SCA converts the call() msg from a -String to a DOM object (org.apache.xerces.dom.DeferredDocumentImpl). It -converts the call1() msg from a String to a XML stream reader -(com.ctc.wstx.sr.ValidatingStreamReader). - -databinding-echo/ - src/ - main/ - java/ - dbecho/ - ComponentAImpl.java - component implementation - ComponentBImpl.java - component implementation - Echo.java - service interface with data binding - EchoDataBindingClient.java - sample client code - Interface1.java - service interface with data binding - Interface2.java - service interface with data bindings - resources/ - META-INF/ - services/ - org.apache.tuscany.sca.core.ModuleActivator - specifies the module activation class to call - EchoDataBinding.composite - composite definition - wsdl/ - echo.wsdl - WSDL deinitions - test/ - java/ - dbecho/ - EchoDataBindingTestCase.java - junit test case - databinding-echo.png - pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -TODO - Needs more description of what else is going on in this test - properties, wsdl? - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows. - -cd databinding-echo -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] [Property] prefix: ABC - [java] [Property] prefix1: ABC - [java] [Property] bar: BAR - [java] ComponentA --> Received message: 123 [java.lang.String] - [java] ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] - [java] ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] - [java] ComponentA --> Returned message: 123 [java.lang.String] - [java] [Property] prefix: ABC - [java] [Property] prefix1: ABC - [java] [Property] bar: BAR - [java] ComponentA --> Received message: 123 [java.lang.String] - [java] ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader] - [java] ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@4c444c44 [com.ctc.wstx.sr.ValidatingStreamReader] - [java] ComponentA --> Returned message: 123 [java.lang.String] - [java] call response = 123 - [java] call1 response = 123 - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd databinding-echo -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running dbecho.EchoDataBindingTestCase -[Property] prefix: ABC -[Property] prefix1: ABC -[Property] bar: BAR -ComponentA --> Received message: 123 [java.lang.String] -ComponentB --> Received message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] -ComponentB --> Returned message: [#document: null] [org.apache.xerces.dom.DeferredDocumentImpl] -ComponentA --> Returned message: 123 [java.lang.String] -[Property] prefix: ABC -[Property] prefix1: ABC -[Property] bar: BAR -ComponentA --> Received message: 123 [java.lang.String] -ComponentB --> Received message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader] -ComponentB --> Returned message: com.ctc.wstx.sr.ValidatingStreamReader@74e274e2 [com.ctc.wstx.sr.ValidatingStreamReader] -ComponentA --> Returned message: 123 [java.lang.String] -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.653 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/databinding-echo/build.xml b/java/sca/samples/databinding-echo/build.xml deleted file mode 100644 index 7f2483f6fb..0000000000 --- a/java/sca/samples/databinding-echo/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/databinding-echo/databinding-echo.png b/java/sca/samples/databinding-echo/databinding-echo.png deleted file mode 100644 index afbbfff285..0000000000 Binary files a/java/sca/samples/databinding-echo/databinding-echo.png and /dev/null differ diff --git a/java/sca/samples/databinding-echo/databinding-echo.svg b/java/sca/samples/databinding-echo/databinding-echo.svg deleted file mode 100644 index 87964abf86..0000000000 --- a/java/sca/samples/databinding-echo/databinding-echo.svg +++ /dev/null @@ -1,408 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - EchoDataBinding - ComponentB - - - - - - ComponentA - - - prefixprefix1bar Interface1 Interface2 EchoReferencebinding.echo - - - messagePrefix complexProperty - @DataBinding("org.w3c.dom.Node")&@DataBinding("javax.xml.stream.XMLStreamReader") @DataBinding("java.lang.String") - - <db:databinding name="org.apache.axiom.om.OMElement" /> - Interface1 - Echo @DataBinding("org.w3c.dom.Node") - @DataBinding("java.lang.String") - - diff --git a/java/sca/samples/databinding-echo/pom.xml b/java/sca/samples/databinding-echo/pom.xml deleted file mode 100644 index 3010c7e89e..0000000000 --- a/java/sca/samples/databinding-echo/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - - sample-databinding-echo - Apache Tuscany SCA Echo Data Binding Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-databinding - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - sample-binding-echo - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 2.0-SNAPSHOT - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java deleted file mode 100644 index 29a5e5c9ad..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -/** - * @version $Rev$ $Date$ - */ -public class ComponentAImpl implements Interface1 { - - private Interface1 componentBReference; - - @Constructor - public ComponentAImpl(@Reference(name = "componentBReference", required = true) - Interface1 componentBReference) { - this.componentBReference = componentBReference; - } - - public String call(String msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentA --> Received message: " + request); - Object ret = componentBReference.call(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentA --> Returned message: " + response); - return (String) ret; - } - - public String call1(String msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentA --> Received message: " + request); - Object ret = componentBReference.call1(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentA --> Returned message: " + response); - return (String) ret; - } - - @Property(name="prefix") - public void setPrefix(String prefix) { - System.out.println("[Property] prefix: " + prefix); - } - - @Property(name="prefix1") - public void setPrefix1(String prefix1) { - System.out.println("[Property] prefix1: " + prefix1); - } - - /** - * @param bar the bar to set - */ - @Property(name="bar") - public void setBar(String bar) { - System.out.println("[Property] bar: " + bar); - } - -} diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java deleted file mode 100644 index e98cd55bcf..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import javax.xml.stream.XMLStreamReader; - -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.Constructor; -import org.oasisopen.sca.annotation.Reference; -import org.w3c.dom.Node; - -/** - * @version $Rev$ $Date$ - */ -@AllowsPassByReference -public class ComponentBImpl implements Interface2 { - - private Echo echoReference; - - @Constructor - public ComponentBImpl(@Reference(name = "echoReference", required = true) - Echo echoReference) { - this.echoReference = echoReference; - } - - public Node call(Node msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentB --> Received message: " + request); - Node ret = (Node) echoReference.echo(msg); - String response = ret + " [" + ret.getClass().getName() + "]"; - System.out.println("ComponentB --> Returned message: " + response); - return ret; - } - - public XMLStreamReader call1(XMLStreamReader msg) { - String request = msg + " [" + msg.getClass().getName() + "]"; - System.out.println("ComponentB --> Received message: " + request); -// XMLStreamReader ret = (XMLStreamReader) echoReference.echo(msg); - String response = request; - System.out.println("ComponentB --> Returned message: " + response); - return msg; - } -} diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/Echo.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/Echo.java deleted file mode 100644 index b47a9c1b85..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/Echo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import org.apache.tuscany.sca.databinding.annotation.DataBinding; -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ - -@DataBinding("org.w3c.dom.Node") -@Remotable -public interface Echo { - Object echo(Object msg); -} diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java deleted file mode 100644 index 9ec3819899..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - * @version $Rev$ $Date$ - */ -public class EchoDataBindingClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("EchoDataBinding.composite"); - - Interface1 componentA = scaDomain.getService(Interface1.class, "ComponentA"); - String response = componentA.call("123"); - String response1= componentA.call1("123"); - - - System.out.println("call response = " + response ); - System.out.println("call1 response = " + response1 ); - - scaDomain.close(); - - } - -} diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface1.java deleted file mode 100644 index 9fff3bb4b9..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface1.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import org.apache.tuscany.sca.databinding.annotation.DataBinding; -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@DataBinding("java.lang.String") -@Remotable -public interface Interface1 { - String call(String msg); - String call1(String msg); -} diff --git a/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface2.java deleted file mode 100644 index 61ed7951e4..0000000000 --- a/java/sca/samples/databinding-echo/src/main/java/dbecho/Interface2.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import javax.xml.stream.XMLStreamReader; - -import org.apache.tuscany.sca.databinding.annotation.DataBinding; -import org.oasisopen.sca.annotation.Remotable; -import org.w3c.dom.Node; - -/** - * @version $Rev$ $Date$ - */ -@DataBinding("org.w3c.dom.Node") -@Remotable -public interface Interface2 { - Node call(Node msg); - @DataBinding("javax.xml.stream.XMLStreamReader") - XMLStreamReader call1(XMLStreamReader msg); -} diff --git a/java/sca/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/java/sca/samples/databinding-echo/src/main/resources/EchoDataBinding.composite deleted file mode 100644 index 30b77a6152..0000000000 --- a/java/sca/samples/databinding-echo/src/main/resources/EchoDataBinding.composite +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - ABC - - - - - - - - - - - - - - - ABC - - - BAR - - - - \ No newline at end of file diff --git a/java/sca/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/java/sca/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl deleted file mode 100644 index ef2308aa73..0000000000 --- a/java/sca/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/java/sca/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java deleted file mode 100644 index 43434d8cee..0000000000 --- a/java/sca/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package dbecho; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * @version $Rev$ $Date$ - */ -public class EchoDataBindingTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("EchoDataBinding.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - protected Interface1 componentA; - - public void testTransform() { - componentA = scaDomain.getService(Interface1.class, "ComponentA"); - componentA.call("123"); - componentA.call1("123"); - } -} diff --git a/java/sca/samples/domain-management/README b/java/sca/samples/domain-management/README deleted file mode 100644 index 6280a28028..0000000000 --- a/java/sca/samples/domain-management/README +++ /dev/null @@ -1,8 +0,0 @@ -Domain Management Sample Tasks -============================== -This sample implements the following sample domain management tasks: -- list deployables in a contribution -- list contribution dependencies -- fuse includes in a composite -- add deployables to a domain composite and wire them - diff --git a/java/sca/samples/domain-management/pom.xml b/java/sca/samples/domain-management/pom.xml deleted file mode 100644 index a64e411922..0000000000 --- a/java/sca/samples/domain-management/pom.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-domain-management - Apache Tuscany SCA Sample Domain Management Tasks - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-assembly - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-assembly-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-contribution - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-contribution-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-workspace - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-workspace-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-workspace-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-node - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-extensibility - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-monitor - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-monitor-logging - 2.0-SNAPSHOT - runtime - - - - xerces - xercesImpl - 2.8.1 - - - - org.apache.tuscany.sca - tuscany-binding-atom - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-contribution-java - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-contribution-namespace - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-contribution-resource - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-implementation-java-xml - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - org.apache.maven.plugins - maven-assembly-plugin - - - assets - package - - single - - - - src/test/resources/assembly/assets.xml - - gnu - ${artifactId} - - - - store - package - - single - - - - src/test/resources/assembly/store.xml - - gnu - ${artifactId} - - - - client - package - - single - - - - src/test/resources/assembly/client.xml - - gnu - ${artifactId} - - - - - - - diff --git a/java/sca/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java b/java/sca/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java deleted file mode 100644 index 28eede693d..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/DistributeAndRunComponents.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.TransformerFactory; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; -import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.implementation.node.NodeImplementation; -import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; -import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.launcher.NodeLauncher; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; -import org.apache.tuscany.sca.workspace.Workspace; -import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -/** - * Sample RunComponents task - * - * Under construction... This sample is similar to the DistributeComponents sample, - * with extra steps to configure SCA runtime nodes with the models, start and stop - * them. - * - * @version $Rev$ $Date$ - */ -public class DistributeAndRunComponents { - - private static URLArtifactProcessor contributionProcessor; - private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; - private static WorkspaceFactory workspaceFactory; - private static AssemblyFactory assemblyFactory; - private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; - private static StAXArtifactProcessor xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; - private static CompositeBuilder domainCompositeBuilder; - private static CompositeBuilder nodeCompositeBuilder; - private static NodeImplementationFactory nodeFactory; - private static AtomBindingFactory atomBindingFactory; - - private static void init() { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - - // Initialize the Tuscany module activators - ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); - for (ModuleActivator activator: moduleActivators.getModuleActivators()) { - activator.start(extensionPoints); - } - - // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); - outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); - - // Get contribution workspace and assembly model factories - workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class); - atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class); - - // Create XML artifact processors - StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); - - // Create contribution content processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - - // Get the model resolvers - modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); - - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); - - // Create a node composite builder - nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, - documentBuilderFactory, transformerFactory, contractMapper, null, monitor); - } - - - public static void main(String[] args) throws Exception { - init(); - - // Create workspace model - Workspace workspace = workspaceFactory.createWorkspace(); - workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); - - // Read the sample store contribution - URI storeURI = URI.create("store"); - URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); - workspace.getContributions().add(storeContribution); - - // Read the sample assets contribution - URI assetsURI = URI.create("assets"); - URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); - Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); - workspace.getContributions().add(assetsContribution); - - // Read the sample client contribution - URI clientURI = URI.create("client"); - URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); - Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); - workspace.getContributions().add(clientContribution); - - // Build the contribution dependencies - Map> contributionDependencies = new HashMap>(); - Set resolved = new HashSet(); - for (Contribution contribution: workspace.getContributions()) { - List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); - - // Resolve contributions - for (Contribution dependency: dependencies) { - if (!resolved.contains(dependency)) { - resolved.add(dependency); - contributionProcessor.resolve(dependency, workspace.getModelResolver()); - } - } - - contributionDependencies.put(contribution, dependencies); - } - - // Create a set of nodes, and assign the sample deployables to them - Map> nodeDependencies = new HashMap>(); - Composite cloudComposite = assemblyFactory.createComposite(); - cloudComposite.setName(new QName("http://sample", "cloud")); - int nodeID = 8100; - for (Contribution contribution: workspace.getContributions()) { - for (Composite deployable: contribution.getDeployables()) { - - // Create a node - Component node = assemblyFactory.createComponent(); - node.setName("Node" + nodeID); - cloudComposite.getComponents().add(node); - - // Add default binding configuration to the node, our samples use - // Atom bindings so here we're just creating default Atom binding - // configurations, but all the other binding types can be configured - // like that too - ComponentService nodeService = assemblyFactory.createComponentService(); - Binding binding = atomBindingFactory.createAtomBinding(); - binding.setURI("http://localhost:" + (8100 + nodeID)); - nodeService.getBindings().add(binding); - node.getServices().add(nodeService); - - // Assign a deployable to the node - NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation(); - nodeImplementation.setComposite(deployable); - node.setImplementation(nodeImplementation); - - // Keep track of what contributions will be needed by the node - nodeDependencies.put(node, contributionDependencies.get(contribution)); - - nodeID++; - } - } - - // Print the model describing the nodes that we just built - System.out.println("cloud.composite"); - System.out.println(print(cloudComposite)); - - // Build the nodes, this will apply their default binding configuration to the - // composites assigned to them - nodeCompositeBuilder.build(cloudComposite); - - // Create a composite model for the domain - Composite domainComposite = assemblyFactory.createComposite(); - domainComposite.setName(new QName("http://sample", "domain")); - - // Add all deployables to it, normally the domain administrator would select - // the deployables to include - domainComposite.getIncludes().addAll(workspace.getDeployables()); - - // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); - - // Print out the resulting domain composite - System.out.println("domain.composite"); - System.out.println(print(domainComposite)); - - // Now start our SCA nodes - List runtimeNodes = new ArrayList(); - NodeLauncher launcher = NodeLauncher.newInstance(); - for (Component node: cloudComposite.getComponents()) { - - // Create a composite containing the components that we want to run - // on the node - Composite runnable = assemblyFactory.createComposite(); - runnable.setName(new QName("http://sample", node.getName())); - NodeImplementation nodeImplementation = (NodeImplementation)node.getImplementation(); - for (Component component: nodeImplementation.getComposite().getComponents()) { - for (Component configured: domainComposite.getComponents()) { - if (configured.getName().equals(component.getName())) { - runnable.getComponents().add(configured); - break; - } - } - } - - // Create the SCA node, give it the composite and the list of contributions - // to use - List dependencies = nodeDependencies.get(node); - org.apache.tuscany.sca.node.launcher.Contribution[] contributions = new org.apache.tuscany.sca.node.launcher.Contribution[dependencies.size()]; - for (int c =0, n = dependencies.size(); c < n; c++) { - Contribution dependency = dependencies.get(c); - contributions[c] = new org.apache.tuscany.sca.node.launcher.Contribution(dependency.getURI(), dependency.getLocation()); - } - SCANode runtimeNode = launcher.createNode("http://sample/" + node.getName(), print(runnable), contributions); - - // Start the node - runtimeNode.start(); - runtimeNodes.add(runtimeNode); - } - - System.out.println("Nodes are running, press enter to stop..."); - System.in.read(); - - for (SCANode runtimeNode: runtimeNodes) { - runtimeNode.stop(); - } - } - - private static String print(Composite composite) throws XMLStreamException, ContributionWriteException, ParserConfigurationException, SAXException, IOException { - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); - xmlProcessor.write(composite, writer); - - // Parse and write again to pretty format it - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); - OutputFormat format = new OutputFormat(); - format.setIndenting(true); - format.setIndent(2); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - XMLSerializer serializer = new XMLSerializer(out, format); - serializer.serialize(document); - return out.toString(); - } -} diff --git a/java/sca/samples/domain-management/src/main/java/manager/DistributeComponents.java b/java/sca/samples/domain-management/src/main/java/manager/DistributeComponents.java deleted file mode 100644 index def0a1894f..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/DistributeComponents.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.TransformerFactory; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; -import org.apache.tuscany.sca.binding.atom.AtomBindingFactory; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ContributionFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.implementation.node.NodeImplementation; -import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory; -import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; -import org.apache.tuscany.sca.policy.PolicyFactory; -import org.apache.tuscany.sca.workspace.Workspace; -import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -/** - * Sample DistributeComponents task - * - * This sample shows how to use a subset of Tuscany to read contribution - * metadata, analyze and resolve contribution dependencies, read and resolve - * the artifacts that they contribute (in particular implementation artifacts, - * interfaces, composites, componentTypes etc.) and assembe and wire the - * deployable composites together in a composite model representing an SCA - * domain composite. - * - * The difference between this sample and the WireComponents sample is an - * extra step to allocate deployable composites to SCA nodes. SCA nodes allow - * you to provide default configuration for the deploayable composites allocated - * to them, for example default binding configuration. - * - * The sample first reads the SCA metadata for three sample contributions, - * reads and resolve the artifacts contained in the contributions, includes all their - * deployable composites in a composite model representing an SCA domain, then - * uses several composite builder utilities to configure them as specified in the - * SCA nodes hosting them and assemble and wire them together. - * Finally it prints the resulting domain composite model, showing service bindings - * configured with the URIs from the nodes hosting them. - * - * @version $Rev$ $Date$ - */ -public class DistributeComponents { - - private static URLArtifactProcessor contributionProcessor; - private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; - private static WorkspaceFactory workspaceFactory; - private static AssemblyFactory assemblyFactory; - private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; - private static StAXArtifactProcessor xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; - private static CompositeBuilder domainCompositeBuilder; - private static CompositeBuilder nodeCompositeBuilder; - private static NodeImplementationFactory nodeFactory; - private static AtomBindingFactory atomBindingFactory; - - private static void init() { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - - // Initialize the Tuscany module activators - ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); - for (ModuleActivator activator: moduleActivators.getModuleActivators()) { - activator.start(extensionPoints); - } - - // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); - outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); - - // Get contribution workspace and assembly model factories - workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - nodeFactory = modelFactories.getFactory(NodeImplementationFactory.class); - atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class); - - // Create XML artifact processors - StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); - - // Create contribution content processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - - // Get the model resolvers - modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); - - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); - - // Create a node composite builder - nodeCompositeBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, - documentBuilderFactory, transformerFactory, contractMapper, null, monitor); - } - - - public static void main(String[] args) throws Exception { - init(); - - // Create workspace model - Workspace workspace = workspaceFactory.createWorkspace(); - workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); - - // Read the sample store contribution - URI storeURI = URI.create("store"); - URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); - workspace.getContributions().add(storeContribution); - - // Read the sample assets contribution - URI assetsURI = URI.create("assets"); - URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); - Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); - workspace.getContributions().add(assetsContribution); - - // Read the sample client contribution - URI clientURI = URI.create("client"); - URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); - Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); - workspace.getContributions().add(clientContribution); - - // Build the contribution dependencies - Set resolved = new HashSet(); - for (Contribution contribution: workspace.getContributions()) { - List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); - - // Resolve contributions - for (Contribution dependency: dependencies) { - if (!resolved.contains(dependency)) { - resolved.add(dependency); - contributionProcessor.resolve(dependency, workspace.getModelResolver()); - } - } - } - - // Create a set of nodes, and assign the sample deployables to them - Composite cloudComposite = assemblyFactory.createComposite(); - cloudComposite.setName(new QName("http://sample", "cloud")); - for (int i = 0, n = workspace.getDeployables().size(); i < n; i++) { - - // Create a node - Component node = assemblyFactory.createComponent(); - node.setName("Node" + i); - cloudComposite.getComponents().add(node); - - // Add default binding configuration to the node, our samples use - // Atom bindings so here we're just creating default Atom binding - // configurations, but all the other binding types can be configured - // like that too - ComponentService nodeService = assemblyFactory.createComponentService(); - Binding binding = atomBindingFactory.createAtomBinding(); - binding.setURI("http://localhost:" + (8100 + i)); - nodeService.getBindings().add(binding); - node.getServices().add(nodeService); - - // Assign a deployable to the node - NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation(); - Composite deployable = workspace.getDeployables().get(i); - nodeImplementation.setComposite(deployable); - node.setImplementation(nodeImplementation); - } - - // Print the model describing the nodes that we just built - System.out.println("cloud.composite"); - print(cloudComposite); - System.out.println(); - - // Build the nodes, this will apply their default binding configuration to the - // composites assigned to them - nodeCompositeBuilder.build(cloudComposite); - - // Create a composite model for the domain - Composite domainComposite = assemblyFactory.createComposite(); - domainComposite.setName(new QName("http://sample", "domain")); - - // Add all deployables to it, normally the domain administrator would select - // the deployables to include - domainComposite.getIncludes().addAll(workspace.getDeployables()); - - // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); - - // Print out the resulting domain composite - System.out.println("domain.composite"); - print(domainComposite); - } - - private static void print(Composite composite) throws XMLStreamException, ContributionWriteException, ParserConfigurationException, SAXException, IOException { - - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); - xmlProcessor.write(composite, writer); - - // Parse and write again to pretty format it - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); - OutputFormat format = new OutputFormat(); - format.setIndenting(true); - format.setIndent(2); - XMLSerializer serializer = new XMLSerializer(System.out, format); - serializer.serialize(document); - } -} diff --git a/java/sca/samples/domain-management/src/main/java/manager/ListComponents.java b/java/sca/samples/domain-management/src/main/java/manager/ListComponents.java deleted file mode 100644 index 27cb31d57f..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/ListComponents.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.workspace.Workspace; -import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; - -/** - * Sample ListComponents task. - * - * This sample shows how to use subset of Tuscany to read contribution - * metadata, analyze and resolve contribution dependencies, read and resolve - * the artifacts that they contribute (in particular implementation artifacts, - * interfaces, composites and componentTypes). - * - * The sample first reads the SCA metadata for two sample contributions, then displays - * their dependencies, reads and resolve the artifacts contained in the contributions, - * and finally prints the deployables composites and the components they declare as - * well as their main characteristics (showing that their interfaces and implementations - * for example are actually resolved). - * - * @version $Rev$ $Date$ - */ -public class ListComponents { - - private static URLArtifactProcessor contributionProcessor; - private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; - private static WorkspaceFactory workspaceFactory; - private static ContributionDependencyBuilder contributionDependencyBuilder; - - private static void init() { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Initialize the Tuscany module activators - ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); - for (ModuleActivator activator: moduleActivators.getModuleActivators()) { - activator.start(extensionPoints); - } - - // Get workspace contribution factory - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - - // Create contribution content processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - - // Get the model resolvers - modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); - } - - - public static void main(String[] args) throws Exception { - init(); - - // Create workspace model - Workspace workspace = workspaceFactory.createWorkspace(); - workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); - - // Read the sample store contribution - URI storeURI = URI.create("store"); - URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); - workspace.getContributions().add(storeContribution); - - // Read the sample assets contribution - URI assetsURI = URI.create("assets"); - URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); - Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); - workspace.getContributions().add(assetsContribution); - - // Build the store contribution dependencies - List dependencies = contributionDependencyBuilder.buildContributionDependencies(storeContribution, workspace); - - // Resolve the contributions - for (Contribution contribution: dependencies) { - contributionProcessor.resolve(contribution, workspace.getModelResolver()); - } - - // List the components declared in the deployables found in the - // contribution, their services, bindings, interfaces, and implementations - for (Composite deployable: storeContribution.getDeployables()) { - System.out.println("Deployable: " + deployable.getName()); - for (Component component: deployable.getComponents()) { - System.out.println(" component: " + component.getName()); - for (ComponentService componentService: component.getServices()) { - System.out.println(" componentService: " + componentService.getName()); - for (Binding binding: componentService.getBindings()) { - System.out.println(" binding: " + binding.getClass() + " - " + binding.getURI()); - } - } - Implementation implementation = component.getImplementation(); - System.out.println(" implementation: " + implementation); - for (Service service: implementation.getServices()) { - System.out.println(" service: " + service.getName()); - InterfaceContract contract = service.getInterfaceContract(); - System.out.println(" interface: " + contract.getInterface()); - } - } - } - } - -} diff --git a/java/sca/samples/domain-management/src/main/java/manager/ListDependencies.java b/java/sca/samples/domain-management/src/main/java/manager/ListDependencies.java deleted file mode 100644 index 1bf8124682..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/ListDependencies.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.File; -import java.net.URI; -import java.net.URL; - -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.workspace.Workspace; -import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; - -/** - * Sample ListDependencies task. - * - * This sample shows how to use a subset of Tuscany to read contribution - * metadata, analyze and resolve contribution dependencies given a set of - * available contributions. - * - * The sample reads the SCA metadata for two sample contributions then - * prints their dependencies. - * - * @version $Rev$ $Date$ - */ -public class ListDependencies { - - private static URLArtifactProcessor contributionProcessor; - private static WorkspaceFactory workspaceFactory; - private static ContributionDependencyBuilder contributionDependencyBuilder; - - private static void init() throws Exception { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Get contribution, workspace and assembly model factories - ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - - // Create contribution info processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - - // Create a monitor - UtilityExtensionPoint services = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = services.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); - } - - - public static void main(String[] args) throws Exception { - init(); - - // Create workspace model - Workspace workspace = workspaceFactory.createWorkspace(); - - // Read the contribution info for the sample contribution - URI storeURI = URI.create("store"); - URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution storeContribution = (Contribution)contributionProcessor.read(null, storeURI, storeURL); - workspace.getContributions().add(storeContribution); - - // Read the contribution info for the assets contribution - URI assetsURI = URI.create("assets"); - URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); - Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); - workspace.getContributions().add(assetsContribution); - - // List the contribution dependencies of each contribution - for (Contribution contribution: workspace.getContributions()) { - System.out.println("Contribution: " + contribution.getURI()); - for (Contribution dependency: contributionDependencyBuilder.buildContributionDependencies(contribution, workspace)) { - System.out.println(" dependency: " + dependency.getURI()); - } - } - } - -} diff --git a/java/sca/samples/domain-management/src/main/java/manager/ListDeployables.java b/java/sca/samples/domain-management/src/main/java/manager/ListDeployables.java deleted file mode 100644 index f5f0b9c655..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/ListDeployables.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.File; -import java.net.URI; -import java.net.URL; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; - -/** - * Sample ListDeployables task. - * - * This sample shows how to use a subset of Tuscany to read contribution - * metadata. - * - * The sample reads the SCA metadata for two sample contributions then - * prints the names of their deployable composites. - * - * @version $Rev$ $Date$ - */ -public class ListDeployables { - - private static URLArtifactProcessor contributionProcessor; - - private static void init() { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Create contribution info processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - } - - public static void main(String[] args) throws Exception { - init(); - - // Read the contribution info for the sample contribution - URI uri = URI.create("store"); - URL url = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution contribution = contributionProcessor.read(null, uri, url); - - // List the deployables in the contribution - for (Composite deployable: contribution.getDeployables()) { - System.out.println("Deployable: " + deployable.getName()); - } - - } - -} diff --git a/java/sca/samples/domain-management/src/main/java/manager/WireComponents.java b/java/sca/samples/domain-management/src/main/java/manager/WireComponents.java deleted file mode 100644 index d24d5c67c9..0000000000 --- a/java/sca/samples/domain-management/src/main/java/manager/WireComponents.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package manager; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.net.URI; -import java.net.URL; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.TransformerFactory; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.SCABindingFactory; -import org.apache.tuscany.sca.assembly.builder.CompositeBuilder; -import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver; -import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory; -import org.apache.tuscany.sca.workspace.Workspace; -import org.apache.tuscany.sca.workspace.WorkspaceFactory; -import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder; -import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl; -import org.apache.xml.serialize.OutputFormat; -import org.apache.xml.serialize.XMLSerializer; -import org.w3c.dom.Document; - -/** - * Sample WireComponents task. - * - * This sample shows how to use a subset of Tuscany to read contribution - * metadata, analyze and resolve contribution dependencies, read and resolve - * the artifacts that they contribute (in particular implementation artifacts, - * interfaces, composites, componentTypes etc.) and assembe and wire the - * deployable composites together in a composite model representing an SCA - * domain composite. - * - * The sample first reads the SCA metadata for three sample contributions, - * reads and resolve the artifacts contained in the contributions, includes all their - * deployable composites in a composite model representing an SCA domain, then - * uses a composite builder utility to assemble and wire the composites together. - * Finally it prints the resulting domain composite model. - * - * @version $Rev$ $Date$ - */ -public class WireComponents { - - private static URLArtifactProcessor contributionProcessor; - private static ModelResolverExtensionPoint modelResolvers; - private static ModelFactoryExtensionPoint modelFactories; - private static WorkspaceFactory workspaceFactory; - private static AssemblyFactory assemblyFactory; - private static XMLOutputFactory outputFactory; - private static DocumentBuilderFactory documentBuilderFactory; - private static TransformerFactory transformerFactory; - private static StAXArtifactProcessor xmlProcessor; - private static ContributionDependencyBuilder contributionDependencyBuilder; - private static CompositeBuilder domainCompositeBuilder; - - private static void init() { - - // Create extension point registry - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class); - Monitor monitor = monitorFactory.createMonitor(); - - // Initialize the Tuscany module activators - ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class); - for (ModuleActivator activator: moduleActivators.getModuleActivators()) { - activator.start(extensionPoints); - } - - // Get XML input/output factories - modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class); - XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class); - outputFactory = modelFactories.getFactory(XMLOutputFactory.class); - documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class); - transformerFactory = modelFactories.getFactory(TransformerFactory.class); - - // Get contribution workspace and assembly model factories - workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class); - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - - // Create XML artifact processors - StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor); - - // Create contribution content processor - URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class); - contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class); - - // Get the model resolvers - modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class); - - // Create a contribution dependency builder - contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor); - - // Create a composite builder - SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class); - IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class); - InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class); - domainCompositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, - documentBuilderFactory, transformerFactory, contractMapper, monitor); - - } - - - public static void main(String[] args) throws Exception { - init(); - - // Create workspace model - Workspace workspace = workspaceFactory.createWorkspace(); - workspace.setModelResolver(new ExtensibleModelResolver(workspace, modelResolvers, modelFactories)); - - // Read the sample store contribution - URI storeURI = URI.create("store"); - URL storeURL = new File("./target/sample-domain-management-store.jar").toURI().toURL(); - Contribution storeContribution = contributionProcessor.read(null, storeURI, storeURL); - workspace.getContributions().add(storeContribution); - - // Read the sample assets contribution - URI assetsURI = URI.create("assets"); - URL assetsURL = new File("./target/sample-domain-management-assets.jar").toURI().toURL(); - Contribution assetsContribution = contributionProcessor.read(null, assetsURI, assetsURL); - workspace.getContributions().add(assetsContribution); - - // Read the sample client contribution - URI clientURI = URI.create("client"); - URL clientURL = new File("./target/sample-domain-management-client.jar").toURI().toURL(); - Contribution clientContribution = contributionProcessor.read(null, clientURI, clientURL); - workspace.getContributions().add(clientContribution); - - // Build the contribution dependencies - Set resolved = new HashSet(); - for (Contribution contribution: workspace.getContributions()) { - List dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace); - - // Resolve contributions - for (Contribution dependency: dependencies) { - if (!resolved.contains(dependency)) { - resolved.add(dependency); - contributionProcessor.resolve(contribution, workspace.getModelResolver()); - } - } - } - - // Create a composite model for the domain - Composite domainComposite = assemblyFactory.createComposite(); - domainComposite.setName(new QName("http://sample", "domain")); - - // Add all deployables to it, normally the domain administrator would select - // the deployables to include - domainComposite.getIncludes().addAll(workspace.getDeployables()); - - // Build the domain composite and wire the components included in it - domainCompositeBuilder.build(domainComposite); - - // Print out the resulting domain composite - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos); - xmlProcessor.write(domainComposite, writer); - - // Parse and write again to pretty format it - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); - Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray())); - OutputFormat format = new OutputFormat(); - format.setIndenting(true); - format.setIndent(2); - XMLSerializer serializer = new XMLSerializer(System.out, format); - serializer.serialize(document); - } - -} diff --git a/java/sca/samples/domain-management/src/test/java/services/Cart.java b/java/sca/samples/domain-management/src/test/java/services/Cart.java deleted file mode 100644 index 3fb5439bc3..0000000000 --- a/java/sca/samples/domain-management/src/test/java/services/Cart.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.apache.tuscany.sca.data.collection.Collection; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Cart extends Collection { - -} diff --git a/java/sca/samples/domain-management/src/test/java/services/Item.java b/java/sca/samples/domain-management/src/test/java/services/Item.java deleted file mode 100644 index 81cefcdbef..0000000000 --- a/java/sca/samples/domain-management/src/test/java/services/Item.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - - -public class Item { - private String name; - private String price; - private String origin; - - public Item() { - } - - public Item(String name, String price, String origin) { - this.name = name; - this.price = price; - this.origin = origin; - } - - public Item(String name, String price) { - this.name = name; - this.price = price; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPrice() { - return price; - } - - public void setPrice(String price) { - this.price = price; - } - - public String getOrigin() { - return origin; - } - - public void setOrigin(String origin) { - this.origin = origin; - } - -} diff --git a/java/sca/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java b/java/sca/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java deleted file mode 100644 index f053ec9f48..0000000000 --- a/java/sca/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class ShoppingCartClientImpl implements Cart { - - @Reference - public Cart cart; - - public Entry[] getAll() { - return cart.getAll(); - } - - public Item get(String key) throws NotFoundException { - return cart.get(key); - } - - public String post(String key, Item item) { - return cart.post(key, item); - } - - public void put(String key, Item item) throws NotFoundException { - cart.put(key, item); - } - - public void delete(String key) throws NotFoundException { - cart.delete(key); - } - - public Entry[] query(String queryString) { - return cart.query(queryString); - } - -} diff --git a/java/sca/samples/domain-management/src/test/java/services/ShoppingCartImpl.java b/java/sca/samples/domain-management/src/test/java/services/ShoppingCartImpl.java deleted file mode 100644 index 9ef59df7a8..0000000000 --- a/java/sca/samples/domain-management/src/test/java/services/ShoppingCartImpl.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class ShoppingCartImpl implements Cart { - - private Map cart; - - @Init - public void init() { - cart = new HashMap(); - } - - public Entry[] getAll() { - Entry[] entries = new Entry[cart.size()]; - int i = 0; - for (Map.Entry e: cart.entrySet()) { - entries[i++] = new Entry(e.getKey(), e.getValue()); - } - return entries; - } - - public Item get(String key) throws NotFoundException { - Item item = cart.get(key); - if (item == null) { - throw new NotFoundException(key); - } else { - return item; - } - } - - public String post(String key, Item item) { - if (key == null) { - key ="cart-" + UUID.randomUUID().toString(); - } - cart.put(key, item); - return key; - } - - public void put(String key, Item item) throws NotFoundException { - if (!cart.containsKey(key)) { - throw new NotFoundException(key); - } - cart.put(key, item); - } - - public void delete(String key) throws NotFoundException { - if (key == null || key.equals("")) { - cart.clear(); - } else { - Item item = cart.remove(key); - if (item == null) - throw new NotFoundException(key); - } - } - - public Entry[] query(String queryString) { - List> entries = new ArrayList>(); - if (queryString.startsWith("name=")) { - String name = queryString.substring(5); - for (Map.Entry e: cart.entrySet()) { - Item item = e.getValue(); - if (item.getName().equals(name)) { - entries.add(new Entry(e.getKey(), e.getValue())); - } - } - } - return entries.toArray(new Entry[entries.size()]); - } - -} diff --git a/java/sca/samples/domain-management/src/test/resources/assembly/assets.xml b/java/sca/samples/domain-management/src/test/resources/assembly/assets.xml deleted file mode 100644 index 10693a89e6..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/assembly/assets.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - assets - false - - jar - - - - - target/test-classes/assets - / - - - target/test-classes/services - /services - - - - diff --git a/java/sca/samples/domain-management/src/test/resources/assembly/client.xml b/java/sca/samples/domain-management/src/test/resources/assembly/client.xml deleted file mode 100644 index 5b34693bee..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/assembly/client.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - client - false - - jar - - - - - target/test-classes/client - / - - - - diff --git a/java/sca/samples/domain-management/src/test/resources/assembly/store.xml b/java/sca/samples/domain-management/src/test/resources/assembly/store.xml deleted file mode 100644 index d19b7eb161..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/assembly/store.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - store - false - - jar - - - - - target/test-classes/store - / - - - - diff --git a/java/sca/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml b/java/sca/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml deleted file mode 100644 index 33fe814c3a..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml b/java/sca/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml deleted file mode 100644 index 14e1cdb672..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/java/sca/samples/domain-management/src/test/resources/client/client.composite b/java/sca/samples/domain-management/src/test/resources/client/client.composite deleted file mode 100644 index 1279b319c4..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/client/client.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml b/java/sca/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml deleted file mode 100644 index 52348106f2..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/java/sca/samples/domain-management/src/test/resources/store/store.composite b/java/sca/samples/domain-management/src/test/resources/store/store.composite deleted file mode 100644 index d4f18771d8..0000000000 --- a/java/sca/samples/domain-management/src/test/resources/store/store.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/domain-webapp/README b/java/sca/samples/domain-webapp/README deleted file mode 100644 index c01a0dd39a..0000000000 --- a/java/sca/samples/domain-webapp/README +++ /dev/null @@ -1,310 +0,0 @@ -Domain Webapp Sample -==================== - -Not actually a webapp just yet as webapp host need to use the new domain for it to work. -If you run the DomainServer in a debugger you will get a server that provides a registry -for servide URLs, listens for Nodes starting and stopping and provides a web page where -you can see what nodes are registered and pull up their web pages. - -Use the nodes from the calculator-distributed to register with this domain - - -========================================== -Below copied from calculator sample as a template for when this gets done - - -This sample implements a simple calculator using SCA components. It uses -exactly the same calculator application classes as the calculator sample but -runs the application distributed across three nodes. - -A node in this sample means an instance of the Tuscany SCA java runtime running -in a Java virtual machine. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open four command prompts and -navigate to this sample directory in each one. There is one command to be run -in each command prompt: - -ant runDomainNode -ant runNodeB -ant runNodeC -ant runNodeA - -Please run the commands in this order. - -OR if you don't have ant, on Windows use - -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.DomainNode -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC -java -cp src\main\resources;..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA - -and on *nix do - -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.DomainNode -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeB -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeC -java -cp src/main/resources:../../lib/tuscany-sca-manifest.jar:target/sample-calculator-distributed.jar node.CalculatorNode mydomain nodeA - - -The processes started on each of these command prompts can be ended by pressing -the key. - - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. NodeA exercises this interface by calling add, subtract, multiply and -divide operations. - -In the case of add and subtract the runtime recognises that -it can't find these services locally and, using the remote (web services) -version of the default SCA binding contacts the add service running in NodeB -and the subtract service running in NodeC. - -On the command prompt where you started NodeA, you would see output of invoking the -calculator functions distributed over NodeB and and NodeC. On the command prompts -where you have started NodeB and NodeC, you would see log messages that indicate that -the add and substract services where called on these nodes respectively. - -The sample demonstrates that the calculator application can be distributed -across multiple nodes with no change to the application or to the SCA description -files. - - -calculator/ - src/ - main/ - java/ - calculator/ - CalculatorService.java - the first component, calls +-/* as - appropriate - AddService.java - adds two numbers - AddServiceImpl.java - SubtractService.java - subtracts one number from another - SubtractServiceImpl.java - MultiplyService.java - multiplies two numbers - MultiplyServiceImpl.java - DivideService.java - divides one number by another - DivideServiceImpl.java - node/ - CalculatorNode.java - runs up an sca application based on - configuration given on the command - line in the form - - CalculatorNode - - it looks for a directory name the same - as and loads the composites - there - - if = nodeA it calls the - +-/* operations otherwise it behaves - like a server and waits for service - requests - DomainNode.java - the node that provides the service - discovery mechanism to the distributed - domain - resources/ - domain - the SCA assembly for the service discovery - function - management/ - the SCA assembly for each nodes management - function - nodeA - the SCA assembly for nodeA's part of the - calculator application - nodeB - the SCA assembly for nodeB's part of the - calculator application - nodeC - the SCA assembly for nodeB's part of the - calculator application - test/ - java/ - calculator/ - DomainInMemoryTestCase.java - JUnit test case which runs all of the - separate ndes in a single VM for test - purposes - calculator-distributed.png - a pictorial representation of the sample - .composite files - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd calculator-distributed -ant compile -ant runDomainNode -ant runNodeB -ant runNodeC -ant runNodeA - -You should see the following output from the four separate command prompt: - -runDomainNode: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] 23-Aug-2007 17:40:40 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8080/ServiceDiscoveryC -omponent/ServiceDiscovery - [java] Domain node started (press enter to shutdown) - [java] Registering service: [mydomain nodeB AddServiceComponent org.apache. -tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent] - [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap -ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon -ent] - [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca -ny.sca.assembly.SCABinding] - [java] Matching service url: http://localhost:8086/SubtractServiceComponent - - [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc -a.assembly.SCABinding] - [java] Matching service url: http://localhost:8085/AddServiceComponent - [java] Java Result: 1 -Terminate batch job (Y/N)? y - - - -runNodeB: - [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ -target/classes/management/ - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Registering service: [mydomain nodeB AddServiceComponent/ org.apache -.tuscany.sca.assembly.SCABinding http://localhost:8085/AddServiceComponent] - [java] 23-Aug-2007 17:41:25 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8085/AddServiceCompone -nt - [java] Node started (press enter to shutdown) - [java] AddService - add 3.0 and 2.0 - - -runNodeC: - [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ -target/classes/management/ - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Registering service: [mydomain nodeC SubtractServiceComponent org.ap -ache.tuscany.sca.assembly.SCABinding http://localhost:8086/SubtractServiceCompon -ent] - [java] 23-Aug-2007 17:41:51 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] Node started (press enter to shutdown) - [java] INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceCo -mponent - [java] SubtractService - subtract 3.0 and 2.0 -Terminate batch job (Y/N)? y - - -runNodeA: - [java] file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/ -target/classes/management/ - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co -mpositeBuilderImpl$1 problem - [java] WARNING: [WARNING] Component reference target not found, it might be - a remote service: AddServiceComponent null - [java] - [java] 23-Aug-2007 17:42:12 org.apache.tuscany.sca.assembly.builder.impl.Co -mpositeBuilderImpl$1 problem - [java] WARNING: [WARNING] Component reference target not found, it might be - a remote service: SubtractServiceComponent null - [java] - [java] Finding service: [mydomain SubtractServiceComponent org.apache.tusca -ny.sca.assembly.SCABinding] - [java] Finding service: [mydomain AddServiceComponent org.apache.tuscany.sc -a.assembly.SCABinding] - [java] CalculatorService - add 3.0 and 2.0 - [java] 3 + 2=5.0 - [java] CalculatorService - subtract 3.0 and 2.0 - [java] 3 - 2=1.0 - [java] CalculatorService - multiply 3.0 and 2.0 - [java] 3 * 2=6.0 - [java] CalculatorService - divide 3.0 and 2.0 - [java] 3 / 2=1.5 - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When running from Maven the four nodes all run within -Java virtual machine. - -cd calculator-distributed -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running calculator.DomainInMemoryTestCase -Setting up distributed nodes -file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class -es/management/ -log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX -Utils). -log4j:WARN Please initialize the log4j system properly. -23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild -erImpl$1 problem -WARNING: [WARNING] Component reference target not found, it might be a remote se -rvice: AddServiceComponent null - -23-Aug-2007 18:18:41 org.apache.tuscany.sca.assembly.builder.impl.CompositeBuild -erImpl$1 problem -WARNING: [WARNING] Component reference target not found, it might be a remote se -rvice: SubtractServiceComponent null - -file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class -es/management/ -Registering service: [mydomain nodeB AddServiceComponent org.apache.tuscany.sca. -assembly.SCABinding http://localhost:8085/AddServiceComponent] -file:/C:/simon/tuscany/java-head/sca/samples/calculator-distributed/target/class -es/management/ -Registering service: [mydomain nodeC SubtractServiceComponent org.apache.tuscany -.sca.assembly.SCABinding http://localhost:8086/SubtractServiceComponent] -Finding service: [mydomain SubtractServiceComponent org.apache.tuscany.sca.assem -bly.SCABinding] -Matching service url: http://localhost:8086/SubtractServiceComponent -Finding service: [mydomain AddServiceComponent org.apache.tuscany.sca.assembly.S -CABinding] -Matching service url: http://localhost:8085/AddServiceComponent -23-Aug-2007 18:18:45 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap -ping -INFO: Added Servlet mapping: http://localhost:8085/AddServiceComponent -23-Aug-2007 18:18:47 org.apache.tuscany.sca.http.jetty.JettyServer addServletMap -ping -INFO: Added Servlet mapping: http://localhost:8086/SubtractServiceComponent -CalculatorService - add 3.0 and 2.0 -AddService - add 3.0 and 2.0 -CalculatorService - subtract 3.0 and 2.0 -SubtractService - subtract 3.0 and 2.0 -CalculatorService - multiply 3.0 and 2.0 -CalculatorService - divide 3.0 and 2.0 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.14 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - - -This shows that the Junit test cases have run successfully. - -Known Bug : ---------- -The processes that are running NodeB and NodeC do not seem to end on pressing the -. This will be fixed for the next release. For this release you should use -^C (Control C) to exit these processes. - - diff --git a/java/sca/samples/domain-webapp/build.xml b/java/sca/samples/domain-webapp/build.xml deleted file mode 100644 index e008e3c9f0..0000000000 --- a/java/sca/samples/domain-webapp/build.xml +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/domain-webapp/pom.xml b/java/sca/samples/domain-webapp/pom.xml deleted file mode 100644 index 0b4309a244..0000000000 --- a/java/sca/samples/domain-webapp/pom.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-samples - 2.0-SNAPSHOT - ../pom.xml - - sample-domain-webapp - Apache Tuscany SCA Domain Webapp Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-domain-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-sca-axis2 - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-http - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-resource - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/domain-webapp/src/main/java/node/DomainServer.java b/java/sca/samples/domain-webapp/src/main/java/node/DomainServer.java deleted file mode 100644 index ea3cddc01b..0000000000 --- a/java/sca/samples/domain-webapp/src/main/java/node/DomainServer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package node; - -import java.io.IOException; - - -/** - * This server program that loads a composite to provide simple registry function. - * This server can be replaced with any registry that is appropriate but the components - * in each node that talk to the registry should be replaced also. - */ -public class DomainServer { - - public static void main(String[] args) { - try { -/* - NodeImpl node = new NodeImpl(); - node.start(); - node.getContributionManager().startContribution(DomainServer.class.getClassLoader().getResource(".")); - - try { - System.out.println("Domain server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - node.stop(); - System.out.println("Domain server stopped"); -*/ - } catch (Exception ex) { - System.out.println("Exception in domain server " + - ex.toString()); - } - } - -} diff --git a/java/sca/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100755 index fbe5880db6..0000000000 --- a/java/sca/samples/domain-webapp/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/domain-webapp/src/main/resources/domain.composite b/java/sca/samples/domain-webapp/src/main/resources/domain.composite deleted file mode 100644 index dbaaebd3c7..0000000000 --- a/java/sca/samples/domain-webapp/src/main/resources/domain.composite +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/domain-webapp/src/main/resources/webroot/index.html b/java/sca/samples/domain-webapp/src/main/resources/webroot/index.html deleted file mode 100644 index 425bd73734..0000000000 --- a/java/sca/samples/domain-webapp/src/main/resources/webroot/index.html +++ /dev/null @@ -1,354 +0,0 @@ - - - -Apache Tuscany Domain - - - - - - - - - - - - -

Apache Tuscany Domain

-
- -

Domain Name:

- -
- -

- -

- - - diff --git a/java/sca/samples/domain-webapp/src/main/resources/webroot/node.png b/java/sca/samples/domain-webapp/src/main/resources/webroot/node.png deleted file mode 100644 index b3c949d224..0000000000 Binary files a/java/sca/samples/domain-webapp/src/main/resources/webroot/node.png and /dev/null differ diff --git a/java/sca/samples/domain-webapp/src/main/resources/webroot/style.css b/java/sca/samples/domain-webapp/src/main/resources/webroot/style.css deleted file mode 100644 index f5bbf23379..0000000000 --- a/java/sca/samples/domain-webapp/src/main/resources/webroot/style.css +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -p,table,li,h1,h2,h3 -{ -font-family: verdana, arial, 'sans serif'; -} - -p, h1, h2, h3, table, li, hr -{ -margin-left: 10pt; -} - -table -{ -border-color: black; -border-collapse: separate; -border-spacing: 0px 1px; - -margin-right: 10pt; -margin-left: 10pt; -width: 800px; -} - -.sourceDetailsTable -{ -width: 600px; -} - -tr, td -{ -margin-left: 0pt; -margin-right: 0pt; -padding-left: 10pt; -font-size: 90%; -} - -p,li,th -{ -font-size: 90%; -margin-left: 10pt; -} - -pre -{ -margin-left: 10pt; -} - -body -{ -#ffffff; -} - -h1,h2,h3,hr -{ -color: firebrick; -} - -a:link {COLOR: firebrick;} -a:visited {COLOR: firebrick;} -a:active {COLOR: navy;} - -.link -{ -COLOR: firebrick; -text-decoration: underline; -} - -.clickable -{ -cursor: pointer -} - -.unread_title -{ -font-weight: bold; -} - -.read_title -{ -font-weight: normal; -} - -.summary -{ -color: DimGrey; -} - -.hidden -{ -display: none; -} - -.source_name -{ -width: 600px; -} - -.alert_text -{ -width: 600px; -} - -.alert_data -{ -margin-left: 10px; -width: 800px; -height: 800px; -} - -.source_0 -{ -background-color: LightGreen; -} - -.source_1 -{ -background-color: LightSkyBlue; -} - -.source_2 -{ -background-color: Khaki; -} - -.source_3 -{ -background-color: LightPink; -} - -.source_4 -{ -background-color: Orange; -} - -.source_5 -{ -background-color: LightCoral; -} - -.source_6 -{ -background-color: Orchid; -} - -.source_7 -{ -background-color: Peru; -} - -.source_8 -{ -background-color: SpringGreen; -} - -.source_9 -{ -background-color: LightGrey; -} - diff --git a/java/sca/samples/feed-aggregator-webapp/README b/java/sca/samples/feed-aggregator-webapp/README deleted file mode 100644 index 3668a7705e..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/README +++ /dev/null @@ -1,55 +0,0 @@ -Feed-aggregator-webapp Sample -============================= -This sample demonstrates using the Feed binding to aggregate ATOM and RSS -feeds and publish a new aggregated feed in a webapp. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file -(target/sample-feed-aggregator-webapp.war) to your web application server. - -Once the web app is deployed use your browser to visit the following URL: - -http://localhost:8080/sample-feed-aggregator-webapp - -You will then see the following displayed in your Web browser. - -http://localhost:8083/atomAggregator -http://localhost:8083/atomAggregator/atomsvc -http://localhost:8083/rssAggregator - -** Please note that if your browser is not configured correctly to receive -feed information, you will be prompted to open each file that contains the feed -information in xml. - - -Building And Running The Sample Using Ant -------------------------------------------- -With the binary distribution the sample can be built using Ant as -follows - -cd feed-aggregator-webapp -ant package - -This should result in a war file (sample-feed-aggregator-webapp.war) in the -target directory. Copy this war file to your web app deployment directory and -follow instructions at the begining of this README. - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd feed-aggregator-webapp -mvn - -This should result in a war file (sample-feed-aggregator-webapp.war) in the -target directory. Follow the steps described in the previous section for -running the web app and for the expected results. - - diff --git a/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.png b/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.png deleted file mode 100644 index 1af95a5eff..0000000000 Binary files a/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.png and /dev/null differ diff --git a/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg b/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg deleted file mode 100644 index a861a5c50f..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/feed-aggregator-webapp.svg +++ /dev/null @@ -1,382 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - FeedAggregator - Sort - - newFirst = true - - RssAggregator - - - - - AtomAggregator - - - Rss Sample - Atom Sample - - - - - - - - - - Engadget - BBC - Oreilly - Apache - - - RSS Atom - sample-feed-aggregator-webapp.war - diff --git a/java/sca/samples/feed-aggregator-webapp/pom.xml b/java/sca/samples/feed-aggregator-webapp/pom.xml deleted file mode 100644 index 874327c7b1..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-feed-aggregator-webapp - war - Apache Tuscany SCA Atom+RSS Feed Aggregator Sample Webapp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-rss-rome - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - - diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java b/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java deleted file mode 100644 index 2c90c0db8c..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/AggregatorImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.abdera.Abdera; -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Entry; -import org.apache.abdera.model.Feed; -import org.apache.abdera.model.Person; -import org.apache.abdera.parser.Parser; -import org.apache.tuscany.sca.binding.atom.collection.Collection; -import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.feed.synd.SyndFeedImpl; -import com.sun.syndication.io.SyndFeedOutput; - -/** - * Implementation of an SCA component that aggregates several - * Atom and RSS feeds. - * - * @version $Rev$ $Date$ - */ -public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection { - - @Reference(required = false) - public Collection atomFeed1; - @Reference(required = false) - public Collection atomFeed2; - - @Reference(required = false) - public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1; - @Reference(required = false) - public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2; - - @Reference(required = false) - public Sort sort; - - @Property - public String feedTitle = "Aggregated Feed"; - @Property - public String feedDescription = "Anonymous Aggregated Feed"; - @Property - public String feedAuthor = "anonymous"; - - public Feed getFeed() { - - // Create a new Feed - Factory factory = Abdera.getNewFactory(); - Feed feed = factory.newFeed(); - feed.setTitle(feedTitle); - feed.setSubtitle(feedDescription); - Person author = factory.newAuthor(); - author.setName(feedAuthor); - feed.addAuthor(author); - feed.addLink("http://tuscany.apache.org", "alternate"); - - // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2 - List entries = new ArrayList(); - if (atomFeed1 != null) { - try { - entries.addAll(atomFeed1.getFeed().getEntries()); - } catch (Exception e) {} - } - if (atomFeed2 != null) { - try { - entries.addAll(atomFeed2.getFeed().getEntries()); - } catch (Exception e) {} - } - if (rssFeed1 != null) { - try { - entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries()); - } catch (Exception e) {} - } - if (rssFeed2 != null) { - try { - entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries()); - } catch (Exception e) {} - } - - // Sort entries by published date - if (sort != null) { - entries = sort.sort(entries); - } - - // Add the entries to the new feed - for (Entry entry: entries) { - feed.addEntry(entry); - } - - return feed; - } - - public Feed query(String queryString) { - Factory factory = Abdera.getNewFactory(); - Feed feed = factory.newFeed(); - feed.setTitle(feedTitle); - feed.setSubtitle(feedDescription); - Person author = factory.newAuthor(); - author.setName(feedAuthor); - feed.addAuthor(author); - feed.addLink("http://tuscany.apache.org", "alternate"); - - Feed allFeed = getFeed(); - if (queryString.startsWith("title=")) { - String title = queryString.substring(6); - - for (Entry entry: allFeed.getEntries()) { - if (entry.getTitle().contains(title)) { - feed.addEntry(entry); - } - } - } - return feed; - } - - public void delete(String id) throws NotFoundException { - } - - public Entry get(String id) throws NotFoundException { - return null; - } - - public Entry post(Entry entry) { - return null; - } - - public void put(String id, Entry entry) throws NotFoundException { - } - - /** - * Convert a ROME feed to an Abdera feed. - * - * @param romeFeed - * @return - */ - private static Feed atomFeed(SyndFeed syndFeed) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - syndFeed.setFeedType("atom_1.0"); - SyndFeedOutput syndOutput = new SyndFeedOutput(); - try { - syndOutput.output(syndFeed, new OutputStreamWriter(bos)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Parser parser = Abdera.getNewParser(); - Document document = parser.parse(new ByteArrayInputStream(bos.toByteArray())); - - return document.getRoot(); - } -} diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java b/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java deleted file mode 100644 index dec073c36b..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/Sort.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.util.List; - -import org.apache.abdera.model.Entry; - -/** - * The Sort service business interface. - * - * @version $Rev$ $Date$ - */ -public interface Sort { - - /** - * Sort feed entries by published date. - * @param entries - * @return - */ - List sort(List entries); -} diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java b/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java deleted file mode 100644 index 354ef2d369..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/java/feed/SortImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import org.apache.abdera.model.Entry; -import org.oasisopen.sca.annotation.Property; - -/** - * Implementation of a Feed Sort service component. - * - * @version $Rev$ $Date$ - */ -public class SortImpl implements Sort { - - @Property - public boolean newFirst = true; - - @SuppressWarnings("unchecked") - public List sort(List entries) { - Entry[] entriesArray = new Entry[entries.size()]; - entriesArray = (Entry[])entries.toArray(entriesArray); - Arrays.sort(entriesArray, new Comparator() { - public int compare(final Object xObj, final Object yObj) { - Date xDate = ((Entry)xObj).getUpdated(); - Date yDate = ((Entry)yObj).getUpdated(); - if (xDate == null) - return -1; - if (newFirst) - return yDate.compareTo(xDate); - else - return xDate.compareTo(yDate); - } - }); - return Arrays.asList(entriesArray); - } -} diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite b/java/sca/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite deleted file mode 100644 index 736563098f..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/resources/FeedAggregator.composite +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - RSS Aggregator Sample - - - - true - - - - - - - - - - - - Atom Aggregator Sample - - - \ No newline at end of file diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index b67fe843ca..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index dea3980e4d..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Feed Aggregator Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - index.html - - - diff --git a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/index.html b/java/sca/samples/feed-aggregator-webapp/src/main/webapp/index.html deleted file mode 100644 index 7b33391a87..0000000000 --- a/java/sca/samples/feed-aggregator-webapp/src/main/webapp/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - Apache Tuscany Feed Aggregator Sample - - - -

Apache Tuscany Feed Aggregator Sample

-

To read the aggregated feeds, point your Web browser to the following addresses:

-
http://localhost:8083/sample-feed-aggregator-webapp/atomAggregator -
http://localhost:8083/sample-feed-aggregator-webapp/atomAggregator/atomsvc (for the Atom service document) -
http://localhost:8083/sample-feed-aggregator-webapp/rssAggregator - - - diff --git a/java/sca/samples/feed-aggregator/README b/java/sca/samples/feed-aggregator/README deleted file mode 100644 index f73baec2fd..0000000000 --- a/java/sca/samples/feed-aggregator/README +++ /dev/null @@ -1,110 +0,0 @@ -Feed Aggregator Sample -====================================== -This sample demonstrates using the Feed binding to aggregate ATOM and RSS -feeds and publish a new aggregated feed. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you run the sample using ant, navigate to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-feed-aggregator.jar launch.LaunchFeedServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-feed-aggregator.jar launch.LaunchFeedServer - -You should see the following output on the screen. - -run: - [java] Added Servlet mapping: http://localhost:8083/rssAggregator - [java] Added Servlet mapping: http://localhost:8083/atomAggregator/* - [java] Sample Feed server started (press enter to shutdown) - - [java] To read the aggregated feeds, point your Web browser to the following addresses: - [java] http://localhost:8083/atomAggregator - [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document) - [java] http://localhost:8083/rssAggregator - -As this point the aggregated Feeds are exposed by a web server started -automatically by the SCA runtime. You can later stop the server by pressing enter. - -Now that the server is started you can point your Web browser to each URL of the -aggregated feeds to see the information in your broswer. These URLs are: - -http://localhost:8083/atomAggregator -http://localhost:8083/atomAggregator/atomsvc -http://localhost:8083/rssAggregator - -** Please note that if your browser is not configured correctly to receive -feed information, you will be prompted to open each file that contains the feed -information in xml. - -Sample Overview ---------------- -The sample provides a single component exposing a Web resource. - -web-resource/ - src/ - main/ - java/ - feed/ - AggregatorImpl.java - implementation of the Feed - aggregator component - Sort.java - utilty interface - SortImpl.java - implementation of the Sort component - launch - LaunchFeedServer.java - starts the SCA Runtime and - publishes the aggregated feeds - resources/ - FeedAggregator.composite - the SCA assembly for this sample - feed-aggregator.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - - -Details of how this sample works --------------------------------- -1. AggregatorImpl is used to implement the two main components here (RSSAggregator & AtomAggregator). -2. AggregatorImpl directly implements the Tuscany Atom Collection interface. It is a component - that provides an Atom feed to respond (see tuscany/modules/binding-atom-abdera) -3. The AggregatorImpl component is not explicitly configured using nested element nor its - implementation class is annotated with @Service annotation. Instead, the Tuscany Atom Collection interface - defines its services using @Remotable annotation. - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd feed-aggregator -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Added Servlet mapping: http://localhost:8083/rssAggregator - [java] Added Servlet mapping: http://localhost:8083/atomAggregator/* - [java] Sample Feed server started (press enter to shutdown) - - [java] To read the aggregated feeds, point your Web browser to the following addresses: - [java] http://localhost:8083/atomAggregator - [java] http://localhost:8083/atomAggregator/atomsvc (for the Atom service document) - [java] http://localhost:8083/rssAggregator - - -Building The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built using -Maven as follows. - -cd feed-aggregator -mvn - diff --git a/java/sca/samples/feed-aggregator/build.xml b/java/sca/samples/feed-aggregator/build.xml deleted file mode 100644 index 0ab6fed7fc..0000000000 --- a/java/sca/samples/feed-aggregator/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/feed-aggregator/feed-aggregator.png b/java/sca/samples/feed-aggregator/feed-aggregator.png deleted file mode 100644 index c8fea8a7b8..0000000000 Binary files a/java/sca/samples/feed-aggregator/feed-aggregator.png and /dev/null differ diff --git a/java/sca/samples/feed-aggregator/feed-aggregator.svg b/java/sca/samples/feed-aggregator/feed-aggregator.svg deleted file mode 100644 index 72fe6a00ac..0000000000 --- a/java/sca/samples/feed-aggregator/feed-aggregator.svg +++ /dev/null @@ -1,364 +0,0 @@ - - - - - - - - - - - - - image/svg+xml - - - - - - - - FeedAggregator - Sort - - newFirst = true - - RssAggregator - - - - - AtomAggregator - - - Rss Sample - Atom Sample - - - - - - - - - - Engadget - BBC - Oreilly - Apache - - - RSS Atom - diff --git a/java/sca/samples/feed-aggregator/pom.xml b/java/sca/samples/feed-aggregator/pom.xml deleted file mode 100644 index ae2aee112c..0000000000 --- a/java/sca/samples/feed-aggregator/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../pom.xml - - sample-feed-aggregator - Apache Tuscany SCA Atom+RSS Feed Aggregator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-rss-rome - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java b/java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java deleted file mode 100644 index 999e9d5520..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/java/feed/AggregatorImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.OutputStreamWriter; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.apache.abdera.Abdera; -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Entry; -import org.apache.abdera.model.Feed; -import org.apache.abdera.model.Person; -import org.apache.abdera.parser.Parser; -import org.apache.tuscany.sca.binding.atom.collection.Collection; -import org.apache.tuscany.sca.binding.atom.collection.NotFoundException; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -import com.sun.syndication.feed.synd.SyndFeed; -import com.sun.syndication.io.SyndFeedOutput; - -/** - * Implementation of an SCA component that aggregates several - * Atom and RSS feeds. - * - * @version $Rev$ $Date$ - */ -public class AggregatorImpl implements org.apache.tuscany.sca.binding.atom.collection.Collection { - - @Reference(required = false) - public Collection atomFeed1; - @Reference(required = false) - public Collection atomFeed2; - - @Reference(required = false) - public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed1; - @Reference(required = false) - public org.apache.tuscany.sca.binding.rss.collection.Collection rssFeed2; - - @Reference(required = false) - public Sort sort; - - @Property - public String feedTitle = "Aggregated Feed"; - @Property - public String feedDescription = "Anonymous Aggregated Feed"; - @Property - public String feedAuthor = "anonymous"; - - public Feed getFeed() { - - // Create a new Feed - Factory factory = Abdera.getNewFactory(); - Feed feed = factory.newFeed(); - feed.setTitle(feedTitle); - feed.setSubtitle(feedDescription); - Person author = factory.newAuthor(); - author.setName(feedAuthor); - feed.addAuthor(author); - feed.addLink("http://tuscany.apache.org/", "alternate"); - - // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2 - List entries = new ArrayList(); - if (atomFeed1 != null) { - try { - entries.addAll(atomFeed1.getFeed().getEntries()); - } catch (Exception e) {} - } - if (atomFeed2 != null) { - try { - entries.addAll(atomFeed2.getFeed().getEntries()); - } catch (Exception e) {} - } - if (rssFeed1 != null) { - try { - entries.addAll(atomFeed(rssFeed1.getFeed()).getEntries()); - } catch (Exception e) {} - } - if (rssFeed2 != null) { - try { - entries.addAll(atomFeed(rssFeed2.getFeed()).getEntries()); - } catch (Exception e) {} - } - - // Sort entries by updated date - if (sort != null) { - entries = sort.sort(entries); - } - - // Add the entries to the new feed - // Also synthesize a feed id and updated field base on entries - Date feedUpdated = new Date( 0 ); - for (Entry entry: entries) { - Date entryUpdated = entry.getUpdated(); - if (( entryUpdated != null ) && ( entryUpdated.compareTo( feedUpdated ) > 0 )) { - feedUpdated = entryUpdated; - } - feed.addEntry(entry); - } - feed.setUpdated( feedUpdated ); - // Note that feed id should be permanent, immutable, and unique - // in order to support proper ETag creation. - // Tough to do when the feed is regenerated with each get. - feed.setId( "http://tuscany.apache.org/feed", true ); - - return feed; - } - - public Feed query(String queryString) { - Factory factory = Abdera.getNewFactory(); - Feed feed = factory.newFeed(); - feed.setTitle(feedTitle); - feed.setSubtitle(feedDescription); - Person author = factory.newAuthor(); - author.setName(feedAuthor); - feed.addAuthor(author); - feed.addLink("http://tuscany.apache.org", "alternate"); - - Feed allFeed = getFeed(); - if (queryString.startsWith("title=")) { - String title = queryString.substring(6); - - for (Entry entry: allFeed.getEntries()) { - if (entry.getTitle().contains(title)) { - feed.addEntry(entry); - } - } - } - return feed; - } - - public void delete(String id) throws NotFoundException { - } - - public Entry get(String id) throws NotFoundException { - return null; - } - - public Entry post(Entry entry) { - return null; - } - - public void put(String id, Entry entry) throws NotFoundException { - } - - /** - * Convert a ROME feed to an Abdera feed. - * - * @param romeFeed - * @return - */ - private static Feed atomFeed(SyndFeed syndFeed) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - - syndFeed.setFeedType("atom_1.0"); - SyndFeedOutput syndOutput = new SyndFeedOutput(); - try { - syndOutput.output(syndFeed, new OutputStreamWriter(bos)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Parser parser = Abdera.getNewParser(); - Document document = parser.parse(new ByteArrayInputStream(bos.toByteArray())); - - return document.getRoot(); - } -} diff --git a/java/sca/samples/feed-aggregator/src/main/java/feed/Sort.java b/java/sca/samples/feed-aggregator/src/main/java/feed/Sort.java deleted file mode 100644 index dec073c36b..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/java/feed/Sort.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.util.List; - -import org.apache.abdera.model.Entry; - -/** - * The Sort service business interface. - * - * @version $Rev$ $Date$ - */ -public interface Sort { - - /** - * Sort feed entries by published date. - * @param entries - * @return - */ - List sort(List entries); -} diff --git a/java/sca/samples/feed-aggregator/src/main/java/feed/SortImpl.java b/java/sca/samples/feed-aggregator/src/main/java/feed/SortImpl.java deleted file mode 100644 index 354ef2d369..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/java/feed/SortImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package feed; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Date; -import java.util.List; - -import org.apache.abdera.model.Entry; -import org.oasisopen.sca.annotation.Property; - -/** - * Implementation of a Feed Sort service component. - * - * @version $Rev$ $Date$ - */ -public class SortImpl implements Sort { - - @Property - public boolean newFirst = true; - - @SuppressWarnings("unchecked") - public List sort(List entries) { - Entry[] entriesArray = new Entry[entries.size()]; - entriesArray = (Entry[])entries.toArray(entriesArray); - Arrays.sort(entriesArray, new Comparator() { - public int compare(final Object xObj, final Object yObj) { - Date xDate = ((Entry)xObj).getUpdated(); - Date yDate = ((Entry)yObj).getUpdated(); - if (xDate == null) - return -1; - if (newFirst) - return yDate.compareTo(xDate); - else - return xDate.compareTo(yDate); - } - }); - return Arrays.asList(entriesArray); - } -} diff --git a/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java b/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java deleted file mode 100644 index 1c549f7cd2..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/java/launch/LaunchFeedServer.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class LaunchFeedServer { - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("FeedAggregator.composite"); - - try { - System.out.println("Sample Feed server started (press enter to shutdown)"); - System.out.println(); - System.out.println("To read the aggregated feeds, point your Web browser to the following addresses:"); - System.out.println("http://localhost:8083/atomAggregator"); - System.out.println("http://localhost:8083/atomAggregator/atomsvc (for the Atom service document)"); - System.out.println("http://localhost:8083/rssAggregator"); - System.out.println(); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - - scaDomain.close(); - System.out.println("Sample Feed server stopped"); - } -} diff --git a/java/sca/samples/feed-aggregator/src/main/resources/FeedAggregator.composite b/java/sca/samples/feed-aggregator/src/main/resources/FeedAggregator.composite deleted file mode 100644 index 8a3a53b4d5..0000000000 --- a/java/sca/samples/feed-aggregator/src/main/resources/FeedAggregator.composite +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - RSS Aggregator Sample - - - - true - - - - - - - - - - - - Atom Aggregator Sample - - - diff --git a/java/sca/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java b/java/sca/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java deleted file mode 100644 index 9fdfe711be..0000000000 --- a/java/sca/samples/feed-aggregator/src/test/java/feed/FeedAggregatorTest.java +++ /dev/null @@ -1,332 +0,0 @@ -package feed; - -import java.io.IOException; -import java.io.Reader; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import junit.framework.Assert; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import org.apache.abdera.Abdera; -import org.apache.abdera.i18n.iri.IRI; -import org.apache.abdera.factory.Factory; -import org.apache.abdera.model.Base; -import org.apache.abdera.model.Content; -import org.apache.abdera.model.Entry; -import org.apache.abdera.model.Feed; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Collection; -import org.apache.abdera.protocol.Response.ResponseType; -import org.apache.abdera.protocol.client.AbderaClient; -import org.apache.abdera.protocol.client.ClientResponse; -import org.apache.abdera.protocol.client.RequestOptions; -import org.apache.abdera.util.EntityTag; -import org.apache.abdera.writer.Writer; -import org.apache.abdera.writer.WriterFactory; -import org.apache.abdera.parser.Parser; - -/** - * Tests use of server provided feed entity tags for Atom binding in Tuscany. - * Tests conditional gets (e.g. get if-none-match) or conditional posts (post if-match) - * using entity tags and last modified entries in headers. - * Uses the SCA provided Provider composite to act as a server. - * Uses the Abdera provided Client to act as a client. - */ -public class FeedAggregatorTest { - public final static String providerURI = "http://localhost:8083/atomAggregator"; - protected static SCADomain scaProviderDomain; - protected static Abdera abdera; - protected static AbderaClient client; - protected static Parser abderaParser; - protected static String eTag; - protected static Date lastModified; - protected static long contentLength; - protected static int numberEntries; - protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time - - @BeforeClass - public static void init() throws Exception { - try { - System.out.println(">>>FeedAggregatorTest.init"); - scaProviderDomain = SCADomain.newInstance("FeedAggregator.composite"); - abdera = new Abdera(); - client = new AbderaClient(abdera); - abderaParser = Abdera.getNewParser(); - } catch ( Throwable e ) { - System.out.println( e ); - e.printStackTrace(); - } - } - - @AfterClass - public static void destroy() throws Exception { - System.out.println(">>>FeedAggregatorTest.destroy"); - scaProviderDomain.close(); - } - - @Test - public void testPrelim() throws Exception { - Assert.assertNotNull(scaProviderDomain); - Assert.assertNotNull( client ); - } - - @Test - public void testFeedBasics() throws Exception { - System.out.println(">>>FeedAggregatorTest.testFeedBasics"); - RequestOptions opts = new RequestOptions(); - // Normal feed request - ClientResponse res = client.get(providerURI, opts); - Assert.assertNotNull(res); - try { - // Asser feed provided since no predicates - Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals(ResponseType.SUCCESS, res.getType()); - // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res ); - - // Perform other tests on feed. - contentLength = getContentLength( res ); - System.out.println( "FeedAggregatorTest.testFeedBasics full contentLength=" + contentLength ); - - Document doc = res.getDocument(); - Assert.assertNotNull( doc ); - Feed feed = doc.getRoot(); - Assert.assertNotNull( feed ); - - // printFeed( "Feed values", " ", feed ); - // RFC 4287 requires non-null id, title, updated elements - Assert.assertNotNull( feed.getId() ); - Assert.assertNotNull( feed.getTitle() ); - Assert.assertNotNull( feed.getUpdated() ); - - eTag = res.getHeader("ETag"); - Assert.assertNotNull( eTag ); - lastModified = res.getLastModified(); - Assert.assertNotNull( lastModified ); - - numberEntries = getEntryCount( feed ); - System.out.println( "FeedAggregatorTest.testFeedBasics number entries=" + numberEntries ); - - // printFeed( "Aggregated Feed Contents:", " ", feed ); - // System.out.println( "FeedAggregatorTest.testFeedBasics feed=" + feed ); - // printResponseHeaders( "Aggregated Feed response headers:", " ", res ); - // System.out.println("Aggregated Feed response body:"); - // prettyPrint(abdera, res.getDocument()); - // printEntryUpdates( "Aggregated Feed feed updates", " ", feed ); - } finally { - res.release(); - } - } - - @Test - public void testUnmodifiedGetIfModified() throws Exception { - System.out.println(">>>FeedAggregatorTest.testFeedUnmodifiedGetIfModified"); - // Feed request with predicates - RequestOptions opts = new RequestOptions(); - final String contentType = "application/atom+xml"; - opts.setContentType(contentType); - opts.setHeader( "If-Modified-Since", dateFormat.format( new Date( 0 ) )); - - ClientResponse res = client.get(providerURI, opts); - Assert.assertNotNull(res); - try { - // Should return 200 - Feed provided since feed is changed. - Assert.assertEquals(200, res.getStatus()); - Assert.assertEquals(ResponseType.SUCCESS, res.getType()); - - String thisETag = res.getHeader("ETag"); - Assert.assertNotNull( thisETag ); - Date thisLastModified = res.getLastModified(); - Assert.assertNotNull( thisLastModified ); - - // Entry count and body size should be equal to basic request - long thisContentLength = getContentLength( res ); - - Document doc = res.getDocument(); - Assert.assertNotNull( doc ); - Feed feed = doc.getRoot(); - Assert.assertNotNull( feed ); - int thisNumberEntries = getEntryCount( feed ); - // System.out.println( "FeedAggregatorTest.UnmodifiedGetIfModified number entries=" + numberEntries + ", this number entries=" + thisNumberEntries ) ; - } finally { - res.release(); - } - } - - @Test - public void testUnmodifiedGetIfUnModified() throws Exception { - System.out.println(">>>FeedAggregatorTest.testFeedUnmodifiedGetIfUnModified"); - // Feed request with predicates - RequestOptions opts = new RequestOptions(); - final String contentType = "application/atom+xml"; - opts.setContentType(contentType); - opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date( 0 ) )); - - ClientResponse res = client.get(providerURI, opts); - Assert.assertNotNull(res); - try { - // Should return 304 - Feed not provided since feed is modified since. - Assert.assertEquals(304, res.getStatus()); - - // Entry count and body size should be equal to basic request - long thisContentLength = getContentLength( res ); - System.out.println( "FeedAggregatorTest.UnModifiedGetIfUnModified saved " + (contentLength - thisContentLength) + " bytes of network traffic due to caching."); - } finally { - res.release(); - } - } - - /** Print feed vital fields. */ - public static void printFeed( String title, String indent, Feed feed ) { - if ( feed == null ) { - System.out.println( title + " feed is null"); - return; - } - - System.out.println( title ); - System.out.println( indent + "id=" + feed.getId() ); - System.out.println( indent + "title=" + feed.getTitle() ); - System.out.println( indent + "updated=" + feed.getUpdated() ); - System.out.println( indent + "author=" + feed.getAuthor() ); - System.out.println( indent + "self link=" + feed.getSelfLink() ); - Collection collection = feed.getCollection(); - if ( collection == null ) { - System.out.println( indent + "collection=null" ); - } else { - System.out.println( indent + "collection=" + collection ); - } - } - - /* Print headers of request. */ - public static void printRequestHeaders( String title, String indent, RequestOptions request ) { - System.out.println( title ); - if ( request == null ) { - System.out.println( indent + " request is null"); - return; - } - String [] headerNames = request.getHeaderNames(); - for ( String headerName: headerNames) { - String header = request.getHeader(headerName); - System.out.println( indent + " header name,value=" + headerName + "," + header ); - } - } - - /* Print headers of response. */ - public static void printResponseHeaders( String title, String indent, ClientResponse response ) { - System.out.println( title ); - if ( response == null ) { - System.out.println( indent + " response is null"); - return; - } - String [] headerNames = response.getHeaderNames(); - for ( String headerName: headerNames) { - String header = response.getHeader(headerName); - System.out.println( indent + " header name,value=" + headerName + "," + header ); - } - - } - - /** Pretty print the document body. */ - public static void prettyPrint(Abdera abdera, Base doc) throws IOException { - WriterFactory factory = abdera.getWriterFactory(); - Writer writer = factory.getWriter("prettyxml"); - writer.writeTo(doc, System.out); - System.out.println(); - } - - /** Print the updated elements of the feed entries. */ - public static void printEntryUpdates( String title, String indent, Feed feed ) { - if ( feed == null ) { - System.out.println( title + " feed is null"); - return; - } - - System.out.println( title ); - List entries = feed.getEntries(); - if ( entries == null ) { - System.out.println( indent + " null entries"); - } - System.out.println( indent + "entries size=" + entries.size()); - - int i = 0; - for ( Entry entry: entries ) { - String entryTitle = entry.getTitle(); - if (( entryTitle != null ) && ( entryTitle.length() > 20 )) - entryTitle = entryTitle.substring( 0, 20 ); - // System.out.println( indent + i++ + ": title=\"" + entryTitle + - // "\", updated=" + entry.getUpdated() + ", published=" + entry.getPublished() ); - System.out.println( indent + i++ + ": title=\"" + entryTitle + - "\", updated=" + entry.getUpdated() ); - } - } - - /** Get the length of the response body content. */ - public static long getContentLength( ClientResponse response ) { - // getContentLenght returns -1 - // contentLength = response.getContentLength(); - try { - Reader reader = response.getReader(); - long actualSkip = reader.skip( Long.MAX_VALUE ); - return actualSkip; - } catch ( IOException e ) { - } - return -1L; - } - - /** Get a count of entries in the feed. */ - public static int getEntryCount( Feed feed ) { - if ( feed == null ) { - return 0; - } - - List entries = feed.getEntries(); - if ( entries == null ) { - return 0; - } - return entries.size(); - } - - /** Given a feed, determine the median point of the entries. - * Use the updated field of the entries to determine median. - * @param feed - * @return - */ - public static Date getUpdatedMedian( Feed feed ) { - Date sentinal = null; - if ( feed == null ) { - return sentinal; - } - - List entries = feed.getEntries(); - if ( entries == null ) { - return sentinal; - } - int size = entries.size(); - if( size == 0 ) { - return sentinal; - } - // System.out.println( "getUpdatedMedian entries size=" + entries.size()); - ArrayList updates = new ArrayList( size ); - - for ( Entry entry: entries ) { - Date entryUpdated = entry.getUpdated(); - if ( entryUpdated == null ) { - entryUpdated = new Date( 0 ); - } - updates.add( entryUpdated ); - } - Collections.sort( updates ); - // System.out.println( "getUpdatedMedian entry min update=" + updates.get( 0 )); - // System.out.println( "getUpdatedMedian entry max update=" + updates.get( size - 1 )); - Date median = updates.get( size/2 ); - // System.out.println( "getUpdatedMedian entry max median=" + median ); - return median; - } -} diff --git a/java/sca/samples/helloworld-bpel-ws/README b/java/sca/samples/helloworld-bpel-ws/README deleted file mode 100644 index 5c669f5da5..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/README +++ /dev/null @@ -1,151 +0,0 @@ -Hello World BPEL Webservices Sample -====================================== -This sample demonstrates an SCA service implemented by a BPEL process, made available as a Web service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory, and do - -ant compile run - -OR if you don't have ant, on Windows do - -mkdir target\classes -mkdir target\wsdl2java-source -java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl -java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl -unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database -javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java -copy src\main\resources\* target\classes -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient - -and on *nix do - -mkdir target/classes -mkdir target/wsdl2java-source -java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl -java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl -unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database -javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java -cp src/main/resources/* target/classes -java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient - -The sample will start an embedded BPEL engine, deploy a process and invoke it. - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -web service binding. - -helloworld-bpel/ - src/ - main/ - java/ - helloworld/ - BPELClient.java - client application for - BEPELHelloWorldComponent - - resources/ - deploy.xml - ODE deployment descriptor - helloworld.bpel - helloworld bpel process - helloworld.componentType - helloworld bpel service description - helloworld.composite - the SCA assembly for this sample - helloworld.wsdl - the service description that describes - the bpel process - log4j.properties - logging configuration - - test/ - java/ - helloworld/ - BPELHelloWorldTestCase.java - JUnit test case - helloworld-bpel.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ - -With the binary distribution the sample can be built and run using Ant as -follows - -cd helloworld-bpel -ant compile -ant run - - -You should see the following output from the run target. - -run: - [java] Starting BPELHelloWorldComponent - [java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes - [java] ::arg:::::: - [java] Hello - [java] ::message:: - [java] Hello - [java] Status: RESPONSE - [java] Response: - [java] Hello World - [java] Hello World - [java] Stopping BPELHelloWorldComponent - [java] Stopped !!! - -BUILD SUCCESSFUL -Total time: 36 seconds - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven, a simple test is present that exercise -the same logic as the client to invoke the BPEl process. - -cd helloworld-bpel -mvn - -You should see the following output from the test phase. - -- - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.BPELHelloWorldTestCase -Starting BPELHelloWorldComponent ->>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes -::arg:::::: -Hello -::message:: -Hello -Status: RESPONSE -Response: -Hello World -Stopping BPELHelloWorldComponent -Stopped !!! -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -[INFO] [jar:jar] -[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar -[INFO] [install:install] -[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend -e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESSFUL -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 53 seconds -[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008 -[INFO] Final Memory: 24M/43M -[INFO] ------------------------------------------------------------------------ - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-bpel-ws/build.xml b/java/sca/samples/helloworld-bpel-ws/build.xml deleted file mode 100644 index c8917007f1..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/build.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.png b/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.png deleted file mode 100644 index 5f53a3c5d1..0000000000 Binary files a/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.png and /dev/null differ diff --git a/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.svg b/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.svg deleted file mode 100644 index 5a98f1a07c..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/helloworld-bpel.svg +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - HelloWorldWebService - - implementation.bpel helloworld.bpel - - diff --git a/java/sca/samples/helloworld-bpel-ws/pom.xml b/java/sca/samples/helloworld-bpel-ws/pom.xml deleted file mode 100644 index 09cb2cbd53..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/pom.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-bpel-ws - Apache Tuscany SCA HelloWorld BPEL as Webservice Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-bpel-ode - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1-incubating - - - - xerces - xercesImpl - 2.8.1 - - - - junit - junit - 4.2 - test - - - - org.apache.tuscany.sca - tuscany-wsdl2java - 2.0-SNAPSHOT - - - - org.apache.tuscany.sdo - tuscany-sdo-tools - 1.1-incubating - - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - runtime - - - - com.sun.xml.bind - jaxb-impl - 2.1.7 - compile - - - javax.xml.stream - stax-api - - - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-surefire-plugin - - 2.3.1 - - false - false - true - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - test-compile - - unpack - - - - - org.apache.ode - ode-dao-jpa-ojpa-derby - 1.1 - zip - true - ${project.build.directory}/test-classes/ - - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1-incubating - - - generate-bpel-helloworld - generate-sources - - ${basedir}/src/main/resources/helloworld.wsdl - ${basedir}/target/wsdl2java-source - HelloWorld - true - true - true - - - generate - - - - - - org.apache.tuscany.sca - tuscany-maven-wsdl2java - 2.0-SNAPSHOT - - - - ${basedir}/src/main/resources/helloworld.wsdl - - - generate - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java b/java/sca/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java deleted file mode 100644 index 971a5373e9..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/java/helloworld/BPELClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Simple BPEL sample application invoking a helloworld - * - * @version $Rev: 613905 $ $Date: 2008-01-21 14:41:15 +0000 (Mon, 21 Jan 2008) $ - */ -public class BPELClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("helloworld.composite"); - HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); - - String result = bpelService.hello("Hello"); - System.out.println(result); - - scaDomain.close(); - - System.exit(0); - } -} diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/deploy.xml b/java/sca/samples/helloworld-bpel-ws/src/main/resources/deploy.xml deleted file mode 100644 index d9d4363832..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/deploy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - true - - - - - diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel b/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel deleted file mode 100644 index a88aa7960c..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.bpel +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - concat($tmpVar,' World') - - - - - - diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType b/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType deleted file mode 100644 index 70273245d7..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.componentType +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite b/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite deleted file mode 100644 index 97262109e6..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl b/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl deleted file mode 100644 index 1cb338b283..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/helloworld.wsdl +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel-ws/src/main/resources/log4j.properties b/java/sca/samples/helloworld-bpel-ws/src/main/resources/log4j.properties deleted file mode 100644 index c1bc0a0b81..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/main/resources/log4j.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Set root logger level to WARN and its only appender to CONSOLE -log4j.rootLogger=OFF, CONSOLE - -# log4j properties to work with commandline tools. -log4j.category.org.mortbay=OFF -log4j.category.org.hibernate.type=OFF -log4j.category.org.objectweb=OFF -log4j.category.org.apache.ode.sql=OFF -log4j.category.org.apache.ode.axis2=OFF -log4j.category.org.apache.ode.bpel.engine=OFF -log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF -log4j.category.org.apache.ode.bpel.epr=OFF -log4j.category.org.apache.openjpa.kernel=OFF - -# Console appender -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java b/java/sca/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java deleted file mode 100644 index 6ad63f87d9..0000000000 --- a/java/sca/samples/helloworld-bpel-ws/src/test/java/helloworld/BPELHelloWorldTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.TestCase; - -import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Tests the BPEL service - * - * @version $Rev: 636807 $ $Date: 2008-03-13 17:32:45 +0000 (Thu, 13 Mar 2008) $ - */ -public class BPELHelloWorldTestCase extends TestCase { - - private SCADomain scaDomain; - HelloPortType bpelService = null; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("helloworld.composite"); - bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); - - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInvoke() throws Exception { - String response = bpelService.hello("Hello"); - assertEquals("Hello World", response); - } -} diff --git a/java/sca/samples/helloworld-bpel/README b/java/sca/samples/helloworld-bpel/README deleted file mode 100644 index bf5f500ef3..0000000000 --- a/java/sca/samples/helloworld-bpel/README +++ /dev/null @@ -1,151 +0,0 @@ -Hello World BPEL Sample -====================================== -This sample demonstrates an SCA service implemented by a BPEL process. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory, and do - -ant compile run - -OR if you don't have ant, on Windows do - -mkdir target\classes -mkdir target\wsdl2java-source -java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl -java -cp ..\..\lib\tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl -unzip ..\..\lib\ode-dao-jpa-ojpa-derby-1.1.zip -d target\database -javac -d target\classes -cp target\classes;..\..\lib\tuscany-sca-manifest.jar -sourcepath src\main\java;target\wsdl2java-source -target 1.5 -g -source 1.5 src\main\java\helloworld\BPELClient.java -copy src\main\resources\* target\classes -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes;target\database helloworld.BPELClient - -and on *nix do - -mkdir target/classes -mkdir target/wsdl2java-source -java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.sdo.generate.XSD2JavaGenerator -targetDirectory target/wsdl2java-source -prefix HelloWorld -noContainment -noUnsettable src/main/resources/helloworld.wsdl -java -cp ../../lib/tuscany-sca-manifest.jar org.apache.tuscany.tools.wsdl2java.generate.WSDL2JavaGenerator -targetDirectory target/wsdl2java-source src/main/resources/helloworld.wsdl -unzip ../../lib/ode-dao-jpa-ojpa-derby-1.1.zip -d target/database -javac -d target/classes -cp target/classes;../../lib/tuscany-sca-manifest.jar -sourcepath src/main/java;target/wsdl2java-source -target 1.5 -g -source 1.5 src/main/java/helloworld/BPELClient.java -cp src/main/resources/* target/classes -java -cp ../../lib/tuscany-sca-manifest.jar:target/classes:target/database helloworld.BPELClient - -The sample will start an embedded BPEL engine, deploy a process and invoke it. - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -web service binding. - -helloworld-bpel/ - src/ - main/ - java/ - helloworld/ - BPELClient.java - client application for - BEPELHelloWorldComponent - - resources/ - deploy.xml - ODE deployment descriptor - helloworld.bpel - helloworld bpel process - helloworld.componentType - helloworld bpel service description - helloworld.composite - the SCA assembly for this sample - helloworld.wsdl - the service description that describes - the bpel process - log4j.properties - logging configuration - - test/ - java/ - helloworld/ - BPELHelloWorldTestCase.java - JUnit test case - helloworld-bpel.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ - -With the binary distribution the sample can be built and run using Ant as -follows - -cd helloworld-bpel -ant compile -ant run - - -You should see the following output from the run target. - -run: - [java] Starting BPELHelloWorldComponent - [java] >>> Deploying : D:\temp\SCA1.1-RC1\tuscany-sca-1.1-incubating\samples\helloworld-bpel\target\classes - [java] ::arg:::::: - [java] Hello - [java] ::message:: - [java] Hello - [java] Status: RESPONSE - [java] Response: - [java] Hello World - [java] Hello World - [java] Stopping BPELHelloWorldComponent - [java] Stopped !!! - -BUILD SUCCESSFUL -Total time: 36 seconds - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven, a simple test is present that exercise -the same logic as the client to invoke the BPEl process. - -cd helloworld-bpel -mvn - -You should see the following output from the test phase. - -- - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.BPELHelloWorldTestCase -Starting BPELHelloWorldComponent ->>> Deploying : D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\classes -::arg:::::: -Hello -::message:: -Hello -Status: RESPONSE -Response: -Hello World -Stopping BPELHelloWorldComponent -Stopped !!! -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 18.656 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -[INFO] [jar:jar] -[INFO] Building jar: D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar -[INFO] [install:install] -[INFO] Installing D:\dev\Opensource\Apache\Tuscany\source\java-sca-1.1\samples\helloworld-bpel\target\sample-helloworld-bpel.jar to C:\Documents and Settings\lresend -e\.m2\repository\org\apache\tuscany\sca\sample-helloworld-bpel\1.1-incubating-SNAPSHOT\sample-helloworld-bpel-1.1-incubating-SNAPSHOT.jar -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESSFUL -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 53 seconds -[INFO] Finished at: Sun Jan 13 09:54:39 PST 2008 -[INFO] Final Memory: 24M/43M -[INFO] ------------------------------------------------------------------------ - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-bpel/build.xml b/java/sca/samples/helloworld-bpel/build.xml deleted file mode 100644 index 890a6427b8..0000000000 --- a/java/sca/samples/helloworld-bpel/build.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel/helloworld-bpel.png b/java/sca/samples/helloworld-bpel/helloworld-bpel.png deleted file mode 100644 index 5f53a3c5d1..0000000000 Binary files a/java/sca/samples/helloworld-bpel/helloworld-bpel.png and /dev/null differ diff --git a/java/sca/samples/helloworld-bpel/helloworld-bpel.svg b/java/sca/samples/helloworld-bpel/helloworld-bpel.svg deleted file mode 100644 index 5a98f1a07c..0000000000 --- a/java/sca/samples/helloworld-bpel/helloworld-bpel.svg +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - HelloWorldWebService - - implementation.bpel helloworld.bpel - - diff --git a/java/sca/samples/helloworld-bpel/pom.xml b/java/sca/samples/helloworld-bpel/pom.xml deleted file mode 100644 index d93676d77d..0000000000 --- a/java/sca/samples/helloworld-bpel/pom.xml +++ /dev/null @@ -1,198 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-bpel - Apache Tuscany SCA HelloWorld BPEL Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-bpel-ode - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1.1 - - - - xerces - xercesImpl - 2.8.1 - - - - junit - junit - 4.5 - test - - - - org.apache.tuscany.sca - tuscany-wsdl2java - 2.0-SNAPSHOT - - - - org.apache.tuscany.sdo - tuscany-sdo-tools - 1.1.1 - - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - runtime - - - - javax.xml.bind - jaxb-api - 2.1 - compile - - - javax.xml.stream - stax-api - - - - - - com.sun.xml.bind - jaxb-impl - 2.1.7 - runtime - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-surefire-plugin - - 2.3.1 - - false - false - true - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack - test-compile - - unpack - - - - - org.apache.ode - ode-dao-jpa-ojpa-derby - 1.1 - zip - true - ${project.build.directory}/test-classes/ - - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1.1 - - - generate-bpel-helloworld - generate-sources - - ${basedir}/src/main/resources/helloworld.wsdl - ${basedir}/target/wsdl2java-source - HelloWorld - true - true - true - - - generate - - - - - - org.apache.tuscany.sca - tuscany-maven-wsdl2java - 2.0-SNAPSHOT - - - - ${basedir}/src/main/resources/helloworld.wsdl - - - generate - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java b/java/sca/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java deleted file mode 100644 index 1826c885c4..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/java/helloworld/BPELClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Simple BPEL sample application invoking a helloworld - * - * @version $Rev$ $Date$ - */ -public class BPELClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("helloworld.composite"); - HelloPortType bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); - - String result = bpelService.hello("Hello"); - System.out.println(result); - - scaDomain.close(); - - System.exit(0); - } -} diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/deploy.xml b/java/sca/samples/helloworld-bpel/src/main/resources/deploy.xml deleted file mode 100644 index 9bd95b2c58..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/deploy.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - true - - - - - diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.bpel b/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.bpel deleted file mode 100644 index a88aa7960c..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.bpel +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - concat($tmpVar,' World') - - - - - - diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.componentType b/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.componentType deleted file mode 100644 index 2b360111cb..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.componentType +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.composite b/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.composite deleted file mode 100644 index b4623b5c2d..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.wsdl b/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.wsdl deleted file mode 100644 index 46cf381577..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/helloworld.wsdl +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel/src/main/resources/log4j.properties b/java/sca/samples/helloworld-bpel/src/main/resources/log4j.properties deleted file mode 100644 index 8649a71550..0000000000 --- a/java/sca/samples/helloworld-bpel/src/main/resources/log4j.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Set root logger level to WARN and its only appender to CONSOLE -log4j.rootLogger=OFF, CONSOLE - -# log4j properties to work with commandline tools. -log4j.category.org.mortbay=OFF -log4j.category.org.hibernate.type=OFF -log4j.category.org.objectweb=OFF -log4j.category.org.apache.ode.sql=OFF -log4j.category.org.apache.ode.axis2=OFF -log4j.category.org.apache.ode.bpel.engine=OFF -log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF -log4j.category.org.apache.ode.bpel.epr=OFF -log4j.category.org.apache.openjpa.kernel=OFF - -# Console appender -log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender -log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout -log4j.appender.CONSOLE.layout.ConversionPattern=%p - %C{1}.%M(%L) | %m%n \ No newline at end of file diff --git a/java/sca/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java b/java/sca/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java deleted file mode 100644 index 1caaa78878..0000000000 --- a/java/sca/samples/helloworld-bpel/src/test/java/helloworld/BPELHelloWorldTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.TestCase; - -import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Tests the BPEL service - * - * @version $Rev$ $Date$ - */ -public class BPELHelloWorldTestCase extends TestCase { - - private SCADomain scaDomain; - HelloPortType bpelService = null; - - /** - * @throws java.lang.Exception - */ - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("helloworld.composite"); - bpelService = scaDomain.getService(HelloPortType.class, "BPELHelloWorldComponent"); - - } - - /** - * @throws java.lang.Exception - */ - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testInvoke() throws Exception { - String response = bpelService.hello("Hello"); - assertEquals("Hello World", response); - } -} diff --git a/java/sca/samples/helloworld-distributed/README b/java/sca/samples/helloworld-distributed/README deleted file mode 100644 index 9462ae4218..0000000000 --- a/java/sca/samples/helloworld-distributed/README +++ /dev/null @@ -1,29 +0,0 @@ -Distributed Helloworld Sample -============================= - -This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which -automatically discovers available nodes and the services they contain. - -In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, -and a webapp using a JSP with which invokes the Helloworld service in the domain. - -To run the sample: - -- Build the two sample modules with mvn or Ant. -- Deploy the helloworld-webapp war to Tomcat. -- Start the standalone node by: - in the helloworld-node folder do "mvn dependency:copy-dependencies" then: - java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar - -- On a web browser go to: - http://localhost:8080/sample-helloworld-webapp - -You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" - -How it works: - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-node/README b/java/sca/samples/helloworld-distributed/helloworld-node/README deleted file mode 100644 index 9462ae4218..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-node/README +++ /dev/null @@ -1,29 +0,0 @@ -Distributed Helloworld Sample -============================= - -This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which -automatically discovers available nodes and the services they contain. - -In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, -and a webapp using a JSP with which invokes the Helloworld service in the domain. - -To run the sample: - -- Build the two sample modules with mvn or Ant. -- Deploy the helloworld-webapp war to Tomcat. -- Start the standalone node by: - in the helloworld-node folder do "mvn dependency:copy-dependencies" then: - java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar - -- On a web browser go to: - http://localhost:8080/sample-helloworld-webapp - -You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" - -How it works: - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-node/pom.xml b/java/sca/samples/helloworld-distributed/helloworld-node/pom.xml deleted file mode 100644 index 1cdedf7d15..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-node/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-node - Apache Tuscany SCA Helloworld Node Sample - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-dynamic - 2.0-SNAPSHOT - test - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java b/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java deleted file mode 100644 index e2b7c698ac..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/Helloworld.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Helloworld { - - String sayHello(String name); - -} diff --git a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java b/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java deleted file mode 100644 index 033b4088c8..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/java/sample/HelloworldImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -public class HelloworldImpl implements Helloworld { - - public String sayHello(String name) { - System.out.println("HelloworldImpl.sayHello: " + name); - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite b/java/sca/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite deleted file mode 100644 index 0f827390c8..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-node/src/main/resources/META-INF/sca-deployables/Helloworld.composite +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/README b/java/sca/samples/helloworld-distributed/helloworld-webapp/README deleted file mode 100644 index 9462ae4218..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/README +++ /dev/null @@ -1,29 +0,0 @@ -Distributed Helloworld Sample -============================= - -This sample demonstrates a distributed SCA domain using the JMS implementation of binding.sca which -automatically discovers available nodes and the services they contain. - -In this sample there are two nodes in the domain, a standalone node containing a Helloworld component, -and a webapp using a JSP with which invokes the Helloworld service in the domain. - -To run the sample: - -- Build the two sample modules with mvn or Ant. -- Deploy the helloworld-webapp war to Tomcat. -- Start the standalone node by: - in the helloworld-node folder do "mvn dependency:copy-dependencies" then: - java -Djava.ext.dirs=target\dependency -jar target\dependency\tuscany-node-dynamic-1.4-SNAPSHOT.jar target\sample-helloworld-node.jar - -- On a web browser go to: - http://localhost:8080/sample-helloworld-webapp - -You should see "Hello world" returned on the web page and the node console should show "HelloworldImpl.sayHello: world" - -How it works: - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/build.xml b/java/sca/samples/helloworld-distributed/helloworld-webapp/build.xml deleted file mode 100644 index ef49524e39..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/build.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/pom.xml b/java/sca/samples/helloworld-distributed/helloworld-webapp/pom.xml deleted file mode 100644 index b298c4eb62..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-webapp - war - Apache Tuscany SCA Distributed Helloworld WebApp Sample - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-sca-jms - 2.0-SNAPSHOT - runtime - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java b/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java deleted file mode 100644 index 04918244f0..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/java/sample/Helloworld.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package sample; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Helloworld { - - String sayHello(String name); -} diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite b/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite deleted file mode 100644 index 0e8de1be42..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 1eefec1c48..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Distributed Helloworld Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - hello.jsp - - - diff --git a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp b/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp deleted file mode 100644 index 873329cf7c..0000000000 --- a/java/sca/samples/helloworld-distributed/helloworld-webapp/src/main/webapp/hello.jsp +++ /dev/null @@ -1,36 +0,0 @@ - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> - - - - - - -

Apache Tuscany Distributed Helloworld Sample

- - Calling service.sayHello("world") returns: - -

- - <%= service.sayHello("world") %> - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/README b/java/sca/samples/helloworld-dojo-webapp/README deleted file mode 100644 index 38392a13b6..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/README +++ /dev/null @@ -1,104 +0,0 @@ -Hello World Dojo RPC Sample -=========================== - -Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 - -This sample demostrates the SCA JSONRPC binding using a simple web app that -uses the RPC support of the Dojo Toolkit to an SCA service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding -but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. - -Sample Overview ---------------- -The sample provides a single service with an operation that reflects -a greeting back to the caller. The service is exposed using the JSONRPC -binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be -used to invoke the SCA service. - -The web app provided shows how the service can be called by using the DOJO toolkit. - -helloworld-dojo-webapp/ - build-dojo.xml - This file is an Ant script used by the - sample build process to download the Dojo Toolkit - and get it included in the WAR file - for use by the sample. - src/ - main/ - java/ - helloworldjsonrpc/ - HelloWorldService.java - service interface - HelloWorldServiceImpl.java - service implementation - resources/ - jsonrpc.composite - the SCA assembly for this sample - webapp - dojo/ - the Dojo toolkit (this directory is created only - when you build the samples from the source distribution) - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - HelloWorldJSONRPC.html - the web application that calls the - SCA service via JSONRPC - style.css - style sheet - - helloworld-jsonrpc-webapp.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file that unpacks the - dojo installation - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd helloworld-dojo-webapp -ant package - -This should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in your -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-dojo-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see a web page that allows you to send messages, via JSONRPC, to the -application running in the Tuscany SCA Runtime - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd helloworld-dojo-webapp -mvn - -Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/helloworld-dojo-webapp/build-dojo.xml b/java/sca/samples/helloworld-dojo-webapp/build-dojo.xml deleted file mode 100644 index 534a1dacd9..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/build-dojo.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/build.xml b/java/sca/samples/helloworld-dojo-webapp/build.xml deleted file mode 100644 index 95813af65a..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/build.xml +++ /dev/null @@ -1,70 +0,0 @@ - - -]> - - - - &buildDependency; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png b/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png deleted file mode 100644 index 57f90aed01..0000000000 Binary files a/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.png and /dev/null differ diff --git a/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg b/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg deleted file mode 100644 index d5c3bc5d3e..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/helloworld-jsonrpc.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldjsonrpc - - HelloWorldJSONServiceComponent - HelloWorldService - WebApp - DOJO - - diff --git a/java/sca/samples/helloworld-dojo-webapp/pom.xml b/java/sca/samples/helloworld-dojo-webapp/pom.xml deleted file mode 100644 index d839ecddc6..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/pom.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-dojo-webapp - war - Apache Tuscany SCA HelloWorld DOJO Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-antrun-plugin - - - - ant - ant-trax - 1.6.5 - - - - - install-dojo - validate - - run - - - - - - - - - - - copy-dojo-files - generate-resources - - run - - - - - - - - - - - - clean-dojo-files - clean - - run - - - - - - - - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - true - - - generate - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java deleted file mode 100644 index 3d8ea24f04..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworldjsonrpc; - -/** - * This is the business interface of the HelloWorld service component. - */ -public interface HelloWorldService { - - String getGreetings(String name); - -} diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java deleted file mode 100644 index b4997ba907..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworldjsonrpc; - -import java.util.Date; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service component. - */ -@Service(HelloWorldService.class) -public class HelloWorldServiceImpl implements HelloWorldService { - - /* - * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() - */ - public String getGreetings(String name) { - return new Date() + ": [JSONRPC] Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite b/java/sca/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite deleted file mode 100644 index e895ab455d..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/resources/jsonrpc.composite +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html b/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html deleted file mode 100644 index 4195f3288c..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/HelloWorldJSONRPC.html +++ /dev/null @@ -1,98 +0,0 @@ - - - -Tuscany JSON-RPC HelloWorld Example - - - - - - - - - - - - - -

Tuscany Dojo JSON-RPC HelloWorld Sample

- -
- - - - - - - - - - - - - - - - -
Dojo Example
-

This example uses the Dojo - Toolkit to create a JavaScript object helloWorldService - for the SCA service 'HelloWorldService' using Dojo's - RPC classes and providing them with HelloWorldService?smd - for Simple Method Description - (SMD) input.

-

It then creates a Dojo button that will envoke the getGreetings - method of the HelloWorldService object.

-
RequestResponse

- -
-
None Yet.
-
-
Dojo Debug:
-
- - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 2c178c1ddc..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 70cd67890a..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany DOJO HelloWorld Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - HelloWorldJSONRPC.html - - - diff --git a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/style.css b/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/style.css deleted file mode 100644 index 1071583264..0000000000 --- a/java/sca/samples/helloworld-dojo-webapp/src/main/webapp/style.css +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -* { font-family: arial; } - -table, th, td { border: 2px solid blue; border-collapse: collapse; } -th { color: white; background-color: blue; } diff --git a/java/sca/samples/helloworld-jms-webapp/README b/java/sca/samples/helloworld-jms-webapp/README deleted file mode 100644 index 9be2e0b0f6..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/README +++ /dev/null @@ -1,130 +0,0 @@ -JMS HelloWorld Sample -===================== -This sample demonstrates a simple webapp containing a hello world style client -and service using the JMS binding for request-response style messaging. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-helloworld-jms-webapp.war ) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-jms-webapp/ - -The port and hostname will of course vary depending on your local installation. - -Configuring the JMS resources ------------------------------ - -The sample requires JMS resources be manually configured in the server environment, these are: - -- a JMS connection factory named "ConnectionFactory" -- a JMS queue named "HelloWorldService" - -See the following for how to define these resources depending on the application server being used: - -Tuscany with embedded ActiveMQ broker -------------------------------------- - - -Apache Tomcat -------------- - -No configuration is necessary for Tomcat as the sample WAR includes everything pre-configured to run -an ActiveMQ embedded JMS broker and to configure the JMS resources in JNDI. - -The JNDI resources are configured in the META-INF/comtext.xml file, for more information on running -ActiveMQ in Tomcat see: http://activemq.apache.org/tomcat.html - - -Apache Geronimo ---------------- - -For Apache Geronimo 2.0.1 (2.0.2 fails to define JMS resources for me) - -Logon to the Geronimo Server Console (http://localhost:8080/console, uid system, pswd manager) - -In the Console Navigation on the left under Services click JMS Resources - -At the bottom of the JMS Resources panel click under Create a new JMS Resource Group click For ActiveMQ - -In Resource Group Name enter "MyRGN" and click next - -At JMS Resource Group click Add Connection Factory - -For JMS Factory Type choose javax.jms.ConnectionFactory and click Next - -In Connection Factory Name enter "ConnectionFactory" and click Next - -Click Add destination - -For JMS Destination Type choose javax.jms.Queue and click Next - -Enter "HelloWorldService" for both Message Destination Name and PhysicalName and click Next - -Click Deploy Now - -Thats it, you're done. - - -WebSphere ---------- - -To define the JMS resources in a new WebSphere Application Server 6.1 installation: - -1) First define a Service integration bus: - -Logon to the WebSphere Integrated Solutions Console (http://localhost:9060/ibm/console) - -On the Left hand menu expand Service integration, and click on Buses. - -In the Buses panel click on New - -Enter a name for the bus, eg MyBus, and click Next, and then click Finish and Save the changes. - -In the Buses panel click on MyBus - -Find the Topology secion and click on Bus members - -Click on Add, leave the defaults and click Next, Next, Next, Finish, and Save the changes. - -Restart WebSphere and when back up logon back on to the Integrated Solutions Console - -2) Now define the JMS rescources - -On the Left hand menu expand Resources, and JMS and click on Connection Facotories. - -In the Connection factories panel click New. - -Leave the Default messaging provider and click OK - -Enter "ConnectionFactory" in the Name and JNDI name and in the Bus name in the Connection pane choose MyBus and click OK - -On the Left hand menu in JMS click on Queues - -In the Queues panel click New, accept the defaults and click OK - -Enter "HelloWorldService" for the Name and JNDI name and in the Bus name in the Connection pane choose MyBus, -and then in the Queue name drop down list choose "Create SIB destination" - -In the Set queue attributes panel enter "HelloWorldService" for the Identifier and click Next, Next, and Finish - -That should take you back to the Queues panel where you can click OK to create the new JMS queue. - -Save the changes - -Restart WebSphere and you're done. - - - -Others... ---------- - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-jms-webapp/pom.xml b/java/sca/samples/helloworld-jms-webapp/pom.xml deleted file mode 100644 index c2d6155233..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-jms-webapp - war - Apache Tuscany SCA JMS HelloWorld Sample in a WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - ${pom.groupId} - tuscany-host-webapp - ${pom.version} - - - - ${pom.groupId} - tuscany-binding-jms-runtime - ${pom.version} - - - - ${pom.groupId} - tuscany-implementation-java-runtime - ${pom.version} - - - - org.apache.activemq - activemq-core - 5.1.0 - runtime - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java b/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index c24a741ee2..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld client implementation - */ -public class HelloWorldClient implements HelloWorldService { - - HelloWorldService helloWorldRef; - - public String sayHello(String name) { - System.out.println("HelloWorldClient.sayHello " + name); - return helloWorldRef.sayHello(name); - } - - public void setHelloWorldRef(HelloWorldService helloWorldRef) { - System.out.println("HelloWorldClient .setHelloWorldService " + helloWorldRef); - this.helloWorldRef = helloWorldRef; - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 17f997f60d..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String sayHello(String name); -} diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java b/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java deleted file mode 100644 index 47756f46aa..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/java/helloworld/HelloWorldServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldServiceImpl implements HelloWorldService { - - public String sayHello(String name) { - System.out.println("HelloWorldServiceImpl .sayHello " + name); - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml b/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml deleted file mode 100644 index 2419887413..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/context.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite b/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite deleted file mode 100644 index f6328d156c..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/META-INF/sca-deployables/HelloWorld.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 86710435ae..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - Apache Tuscany JMS Web Service Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - hello.jsp - - - - - - - diff --git a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp b/java/sca/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp deleted file mode 100644 index bc6ef59a9b..0000000000 --- a/java/sca/samples/helloworld-jms-webapp/src/main/webapp/hello.jsp +++ /dev/null @@ -1,44 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> -<%@ page import="helloworld.HelloWorldService" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - HelloWorldService helloWorldService = (HelloWorldService)scaDomain.getService(HelloWorldService.class, "HelloWorldClient"); -%> - -HelloWorld JMS sample - - - -If this sample is working correctly you should see "Hello World" on the next line... -

-<%= helloWorldService.sayHello("world") %> -

-If you do not see "Hello World" on the line above then there has been a problem. -

-The sample requires JMS resources be manually configured in the server environment, these are: -a JMS connection factory named "ConnectionFactory", and a destination queues named "HelloWorldService". -See the sample README file for more information. - - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/README b/java/sca/samples/helloworld-jsonrpc-webapp/README deleted file mode 100644 index 07253d039b..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/README +++ /dev/null @@ -1,90 +0,0 @@ -Hello World JSONRPC Sample -========================== -This sample demostrates the JSONRPC binding using a simple web app that -talks JSONRPC to an SCA service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-helloworld-jsonrpc-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-jsonrpc-webapp - -The port and hostname will of course vary depending on your local installation. - -Sample Overview ---------------- -The sample provides a single service with an operation that reflects -a greeting back to the caller. The service is exposed using the JSONRPC -binding. The web app provided shows how the SCA-provided JSON client can be -used to invoke the SCA service. - -helloworld-jsonrpc-webapp/ - src/ - main/ - java/ - helloworldjsonrpc/ - HelloWorldService.java - service interface - HelloWorldServiceImpl.java - service implementation - resources/ - jsonrpc.composite - the SCA assembly for this sample - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - HelloWorldJSONRPC.html - the web application that calls the - SCA service via JSONRPC - style.css - style sheet - - helloworld-jsonrpc-webapp.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file that unpacks the - dojo installation - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd helloworld-jsonrpc-webapp -ant package - -This should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in your -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-jsonrpc-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see a web page that allows you to send messages, via JSONRPC, to the -application running in the Tuscany SCA Runtime - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd helloworld-jsonrpc-webapp -mvn - -Again this should result in a war file (sample-helloworld-jsonrpc-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png b/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png deleted file mode 100644 index 57f90aed01..0000000000 Binary files a/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.png and /dev/null differ diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg b/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg deleted file mode 100644 index 6ef1f438fb..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/helloworld-jsonrpc.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldjsonrpc - - HelloWorldJSONServiceComponent - HelloWorldService - WebApp - DOJO - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/pom.xml b/java/sca/samples/helloworld-jsonrpc-webapp/pom.xml deleted file mode 100644 index 9d3b27d8cc..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-jsonrpc-webapp - war - Apache Tuscany SCA HelloWorld JSON-RPC Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java deleted file mode 100644 index 3d8ea24f04..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworldjsonrpc; - -/** - * This is the business interface of the HelloWorld service component. - */ -public interface HelloWorldService { - - String getGreetings(String name); - -} diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java deleted file mode 100644 index 2234e21439..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/java/helloworldjsonrpc/HelloWorldServiceImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworldjsonrpc; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service component. - */ -@Service(HelloWorldService.class) -public class HelloWorldServiceImpl implements HelloWorldService { - - /* - * @see org.apache.tuscany.samples.helloworld.HelloWorldServiceComponent#getGreetings() - */ - public String getGreetings(String name) { - return "jsonrpcHello " + name; - } - -} diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite deleted file mode 100644 index e895ab455d..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/resources/jsonrpc.composite +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html deleted file mode 100644 index 75dd9050fa..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/HelloWorldJSONRPC.html +++ /dev/null @@ -1,75 +0,0 @@ - - - - Tuscany JSON-RPC HelloWorld Example - - - - - - - - - - -

Tuscany JSON-RPC HelloWorld Sample

- - - - - - - - - - - - - - - -
Non-Dojo Example
- This example uses the JavaScript served from - SCADomain/scaDomain.js - to make JSON-RPC requests to the SCA service 'HelloWorldService' -
RequestResponse
-

- Name please:     - - -

- -
-
None Yet.
-
- - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index c8246e15a7..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 267bed176c..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany JSON-RPC HelloWorld Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - HelloWorldJSONRPC.html - - - diff --git a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css b/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css deleted file mode 100644 index 1071583264..0000000000 --- a/java/sca/samples/helloworld-jsonrpc-webapp/src/main/webapp/style.css +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -* { font-family: arial; } - -table, th, td { border: 2px solid blue; border-collapse: collapse; } -th { color: white; background-color: blue; } diff --git a/java/sca/samples/helloworld-jsp/pom.xml b/java/sca/samples/helloworld-jsp/pom.xml deleted file mode 100644 index c2604065ca..0000000000 --- a/java/sca/samples/helloworld-jsp/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-jsp - war - Apache Tuscany SCA Helloworld JSP Sample - - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - 2.0-SNAPSHOT - runtime - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java b/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java deleted file mode 100644 index 2b92fd4661..0000000000 --- a/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldService.java +++ /dev/null @@ -1,7 +0,0 @@ -package sample; - -public interface HelloworldService { - - String sayHello(String name); - -} diff --git a/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java deleted file mode 100644 index 2664e75188..0000000000 --- a/java/sca/samples/helloworld-jsp/src/main/java/sample/HelloworldServiceImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Service; - -@Service(HelloworldService.class) -public class HelloworldServiceImpl implements HelloworldService { - - public String sayHello(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite deleted file mode 100644 index 16bc08fc10..0000000000 --- a/java/sca/samples/helloworld-jsp/src/main/webapp/META-INF/sca-deployables/web.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 46285614da..0000000000 --- a/java/sca/samples/helloworld-jsp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Apache Tuscany Helloworld JSP Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - hello.jsp - - - diff --git a/java/sca/samples/helloworld-jsp/src/main/webapp/hello.jsp b/java/sca/samples/helloworld-jsp/src/main/webapp/hello.jsp deleted file mode 100644 index beac8e457f..0000000000 --- a/java/sca/samples/helloworld-jsp/src/main/webapp/hello.jsp +++ /dev/null @@ -1,36 +0,0 @@ - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<%@ taglib uri="http://www.osoa.org/sca/sca_jsp.tld" prefix="sca" %> - - - - - - -

Apache Tuscany Helloworld JSP Sample

- - Calling HelloworldService sayHello("world") returns: - -

- - <%= service.sayHello("world") %> - - - diff --git a/java/sca/samples/helloworld-reference-jms/README b/java/sca/samples/helloworld-reference-jms/README deleted file mode 100644 index 184e67a239..0000000000 --- a/java/sca/samples/helloworld-reference-jms/README +++ /dev/null @@ -1,114 +0,0 @@ -Hello World JMS References Sample -================================= -This sample demonstrates an SCA reference that uses a JMS binding - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens you need to run the server first -so open a command prompt, navigate to the helloworld-service-jms sample directory -and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-service-jms.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-service-jms.jar helloworld.HelloWorldServer - - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-reference-jms.jar helloworld.HelloWorldJmsClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-reference-jms.jar helloworld.HelloWorldJmsClient - - -Sample Overview ---------------- -The sample provides a component that has a reference with a JMS binding. -The binding refers to JMS queue and communicates with a service -exposed by the helloworld-service-jms sample. - -helloworld-reference-jms/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldJmsClient.java - starts the SCA Runtime and - deploys the helloworldwsjmsclient - .composite. It then calls the - HelloWorldServiceComponent - resources/ - helloworldjmsclient.composite - the SCA assembly for this sample - helloworldjms.composite - the SCA assembly for the server - that is used by the JUnit tests - logging.properties - log4j configuration file - test/ - java/ - helloworld/ - HelloWorldJMSClientTestCase.java - JUnit test case - helloworld-reference.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. Before -you do this start up the service that the reference will talk to. To do this -run up the helloworld-service-jms test. Take a look at the README in that sample -and you will see you need the following commands - -cd helloworld-service-jms -ant run - -Once done you can now compile and run this sample using the following commands; - -cd helloworld-reference-jms -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -service-jms sample first as the JUnit test does this for you. - -cd helloworld-reference-jms -mvn - -You should see the following output from the test phase. - -run: - [java] Injected helloWorldService - [java] Called getGreetings - [java] javax.naming.NameNotFoundException: RequestQueue - ... - [java] Hello World - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-reference-jms/build.xml b/java/sca/samples/helloworld-reference-jms/build.xml deleted file mode 100644 index 4702beed0d..0000000000 --- a/java/sca/samples/helloworld-reference-jms/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-reference-jms/helloworld-reference.png b/java/sca/samples/helloworld-reference-jms/helloworld-reference.png deleted file mode 100644 index ab80b1f91c..0000000000 Binary files a/java/sca/samples/helloworld-reference-jms/helloworld-reference.png and /dev/null differ diff --git a/java/sca/samples/helloworld-reference-jms/helloworld-reference.svg b/java/sca/samples/helloworld-reference-jms/helloworld-reference.svg deleted file mode 100644 index 40f4e8f271..0000000000 --- a/java/sca/samples/helloworld-reference-jms/helloworld-reference.svg +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldjmsreference - - HelloWorldServiceComponent - - HelloWorldService ReferenceJMS - diff --git a/java/sca/samples/helloworld-reference-jms/pom.xml b/java/sca/samples/helloworld-reference-jms/pom.xml deleted file mode 100644 index 77d887509c..0000000000 --- a/java/sca/samples/helloworld-reference-jms/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-reference-jms - Apache Tuscany SCA HelloWorld Reference JMS Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jms-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-helloworld-service-jms - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - org.apache.activemq - apache-activemq - 4.1.1 - test - - - org.apache.activemq - activemq-web-demo - - - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 2186c00e57..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java deleted file mode 100644 index 5bec27a137..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate the HelloWorld service and invoke it. - */ -public class HelloWorldJmsClient { - - public final static void main(String[] args) throws Exception { - //SCANode node = SCANodeFactory.createNodeWithComposite("helloworldjmsreference.composite"); - //HelloWorldService helloWorldService = node.getDomain().getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - SCADomain scaDomain = SCADomain.newInstance("helloworldjmsreference.composite"); - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index ca7c90f23e..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java deleted file mode 100644 index 27cef47677..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld service implementation - */ -public class HelloWorldServiceComponent implements HelloWorldService { - - HelloWorldService helloWorldService; - - public String getGreetings(String name) { - System.out.println("Called getGreetings"); - return helloWorldService.getGreetings(name); - } - - public HelloWorldService getHelloWorldService() { - System.out.println("Got Injected helloWorldService"); - return helloWorldService; - } - - public void setHelloWorldService(HelloWorldService helloWorldService) { - System.out.println("Injected helloWorldService"); - this.helloWorldService = helloWorldService; - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite b/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite deleted file mode 100644 index 3cf1104562..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsreference.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite b/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite deleted file mode 100644 index e692ef8e4c..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/resources/helloworldjmsservice.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-reference-jms/src/main/resources/logging.properties b/java/sca/samples/helloworld-reference-jms/src/main/resources/logging.properties deleted file mode 100644 index a2a4067921..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev: 582827 $ $Date: 2007-10-08 15:01:31 +0100 (Mon, 08 Oct 2007) $ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index e0ea596dd3..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/java/sca/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java deleted file mode 100644 index f5380d9ccd..0000000000 --- a/java/sca/samples/helloworld-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - - -/** - * Test case for helloworld web service client - */ -public class HelloWorldJmsClientTestCase { - - private HelloWorldService helloWorldService; - private HelloWorldService helloTuscanyService; - private SCADomain scaClientDomain; - private SCADomain scaServiceDomain; - private BrokerService jmsBroker; - - - @Before - public void startClient() throws Exception { - try { - startBroker(); - scaServiceDomain = SCADomain.newInstance("helloworldjmsservice.composite"); - scaClientDomain = SCADomain.newInstance("helloworldjmsreference.composite"); - helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testWSClient() throws Exception { - String msg = helloWorldService.getGreetings("Smith"); - Assert.assertEquals("Hello Smith", msg); - Thread.sleep(2000); - } - - - @After - public void stopClient() throws Exception { - scaServiceDomain.close(); - scaClientDomain.close(); - if (jmsBroker != null) { - jmsBroker.stop(); - } - } - - protected void startBroker() throws Exception { - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - } -} diff --git a/java/sca/samples/helloworld-service-jms/README b/java/sca/samples/helloworld-service-jms/README deleted file mode 100644 index 49feabaa07..0000000000 --- a/java/sca/samples/helloworld-service-jms/README +++ /dev/null @@ -1,101 +0,0 @@ -Hello World JMS Service Sample -============================== -This sample demonstrates an SCA service that uses a JMS binding - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-service-jms.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-service-jms.jar helloworld.HelloWorldServer - -Now the server is started you can use the helloworld-reference-jms sample to -exercise it. - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -JMS binding. - -helloworld-service-jms/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldImpl.java - component implementation - HelloWorldServer.java - starts the SCA Runtime and - deploys the helloworldjmsservice - .composite and then waits for the - service to be called via JMS - resources/ - helloworldjmsservice.composite - the SCA assembly for this sample - - test/ - java/ - helloworld/ - HelloWorldJMSServerTestCase.java- JUnit test case - helloworld-service.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd helloworld-service-jms -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] HelloWorld server started (press enter to shutdown) - -As this point the SCA service is exposed as a JMS service via ActiveMQ which is -started automatically by the SCA runtime. To stop the server just press -enter. - -To exercise the service run up the helloworld-reference-jms sample. Take a look at -the README in that sample and you will see you need the following commands - -cd helloworld-reference-jms -ant run - -Building Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built -using Maven as follows. - -cd helloworld-service-jms -mvn - -You should see the following output - -... -[INFO] ------------------------------------------------------------------------ -[INFO] BUILD SUCCESSFUL -[INFO] ------------------------------------------------------------------------ -[INFO] Total time: 15 seconds -[INFO] Finished at: Wed Jul 02 12:50:24 BST 2008 -[INFO] Final Memory: 13M/51M -[INFO] ------------------------------------------------------------------------ - - -This shows that the module has compiled successfully. diff --git a/java/sca/samples/helloworld-service-jms/build.xml b/java/sca/samples/helloworld-service-jms/build.xml deleted file mode 100644 index 330de7f7e5..0000000000 --- a/java/sca/samples/helloworld-service-jms/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-service-jms/helloworld-service.png b/java/sca/samples/helloworld-service-jms/helloworld-service.png deleted file mode 100644 index ef27c71f54..0000000000 Binary files a/java/sca/samples/helloworld-service-jms/helloworld-service.png and /dev/null differ diff --git a/java/sca/samples/helloworld-service-jms/helloworld-service.svg b/java/sca/samples/helloworld-service-jms/helloworld-service.svg deleted file mode 100644 index dd7a9dd87d..0000000000 --- a/java/sca/samples/helloworld-service-jms/helloworld-service.svg +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworld - - HelloWorldServiceComponent - HelloWorldServiceJMS - diff --git a/java/sca/samples/helloworld-service-jms/pom.xml b/java/sca/samples/helloworld-service-jms/pom.xml deleted file mode 100644 index c2be08fa75..0000000000 --- a/java/sca/samples/helloworld-service-jms/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-service-jms - Apache Tuscany SCA HelloWorld Service JMS Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jms-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - org.apache.activemq - apache-activemq - 4.1.1 - - - org.apache.activemq - activemq-web-demo - - - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 2186c00e57..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java b/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index d4ea391a00..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - public static void main(String[] args) { - try { - BrokerService jmsBroker; - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - - SCADomain scaDomain = SCADomain.newInstance("helloworldjmsservice.composite"); - - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - - scaDomain.close(); - - jmsBroker.stop(); - System.out.println("HelloWorld server stopped"); - - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index a0081be22d..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} - diff --git a/java/sca/samples/helloworld-service-jms/src/main/resources/definitions.xml b/java/sca/samples/helloworld-service-jms/src/main/resources/definitions.xml deleted file mode 100644 index 8c881ab0bb..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/resources/definitions.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - The general intent that a transport is available over which SOAP messages flow - - - - - - A JMS transport is required - - - - - - An HTTP transport is required - - - - - - - An HTTPS transport is required - - - - - - - org.apache.activemq.jndi.ActiveMQInitialContextFactory - tcp://localhost:61619 - QueueConnectionFactory - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite b/java/sca/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite deleted file mode 100644 index 3135cdc320..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/resources/helloworldjmsservice.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 3f9e00689e..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java b/java/sca/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java deleted file mode 100644 index 7930f98716..0000000000 --- a/java/sca/samples/helloworld-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCaseOff.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldJmsServerTestCaseOff { - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - // ActiveMQModuleActivator.startBroker(); - scaDomain = SCADomain.newInstance("helloworldjmsservice.composite"); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = - scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - if (scaDomain != null) { - scaDomain.close(); - } - } - -} diff --git a/java/sca/samples/helloworld-servlet/pom.xml b/java/sca/samples/helloworld-servlet/pom.xml deleted file mode 100644 index 26fa4e62d2..0000000000 --- a/java/sca/samples/helloworld-servlet/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-servlet - war - Apache Tuscany SCA Helloworld Sample using a servlet - - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - 2.0-SNAPSHOT - runtime - - - - javax.servlet - servlet-api - 2.3 - provided - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java b/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java deleted file mode 100644 index 2b92fd4661..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldService.java +++ /dev/null @@ -1,7 +0,0 @@ -package sample; - -public interface HelloworldService { - - String sayHello(String name); - -} diff --git a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java deleted file mode 100644 index 2664e75188..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServiceImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Service; - -@Service(HelloworldService.class) -public class HelloworldServiceImpl implements HelloworldService { - - public String sayHello(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java b/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java deleted file mode 100644 index 6b8af48161..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/java/sample/HelloworldServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package sample; - -import java.io.IOException; -import java.io.Writer; - -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.oasisopen.sca.ComponentContext; -import org.oasisopen.sca.annotation.Reference; - -/** - */ -public class HelloworldServlet extends HttpServlet { - private static final long serialVersionUID = 1L; - - @Reference - protected HelloworldService service; - - @Override - public void init(ServletConfig config) { - if (service == null) { - // The helloworldService 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 cc = (ComponentContext)config.getServletContext().getAttribute("org.oasisopen.sca.ComponentContext"); - service = cc.getService(HelloworldService.class, "service"); - } - } - - @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { - - String name = request.getParameter("name"); - String greeting = service.sayHello(name); - - Writer out = response.getWriter(); - out.write("Apache Tuscany Helloworld Servlet Sample"); - out.write("

Apache Tuscany Helloworld Servlet Sample

"); - out.write("
Result: " + greeting); - out.write(""); - out.flush(); - out.close(); - } -} diff --git a/java/sca/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite deleted file mode 100644 index 23fd33a408..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/webapp/META-INF/sca-deployables/web.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 28cfdd3f6c..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - Apache Tuscany Helloworld Servlet Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - HelloworldServlet - sample.HelloworldServlet - - - - HelloworldServlet - /HelloworldServlet - - - - hello.html - - - diff --git a/java/sca/samples/helloworld-servlet/src/main/webapp/hello.html b/java/sca/samples/helloworld-servlet/src/main/webapp/hello.html deleted file mode 100644 index c4484916aa..0000000000 --- a/java/sca/samples/helloworld-servlet/src/main/webapp/hello.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - -Apache Tuscany Helloworld Servlet Sample - - - - -

Apache Tuscany Helloworld Servlet Sample

- -
- - - - - - - - -
Enter your name: - -
- -
-
- - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-web-callback/pom.xml b/java/sca/samples/helloworld-web-callback/pom.xml deleted file mode 100644 index 4a15d1a8ea..0000000000 --- a/java/sca/samples/helloworld-web-callback/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-web-callback - war - Apache Tuscany SCA Web 2.0 Callbacks Sample - - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-dwr - 2.0-SNAPSHOT - runtime - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java b/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java deleted file mode 100644 index 2ee8e97e51..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface HelloworldCallback { - - @OneWay - void sayHelloCallback(String reply); -} diff --git a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java b/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java deleted file mode 100644 index 9c1e645776..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldService.java +++ /dev/null @@ -1,14 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -@Callback(HelloworldCallback.class) -public interface HelloworldService { - - @OneWay - void sayHello(String name); - -} diff --git a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java deleted file mode 100644 index 5601bcd990..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/java/sample/HelloworldServiceImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Service; - -@Service(HelloworldService.class) -public class HelloworldServiceImpl implements HelloworldService { - - @Callback - public HelloworldCallback callback; - - public void sayHello(final String name) { - Thread t = new Thread(new Runnable() { - public void run() { - for (int i=0; i<5; i++) { - callback.sayHelloCallback(i + "Hello " + name); - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - }}); - t.start(); - } - -} diff --git a/java/sca/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite deleted file mode 100644 index fdd5a95f58..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/webapp/META-INF/sca-deployables/web.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index f29262a147..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Apache Tuscany Helloworld Servlet Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - hello.html - - - diff --git a/java/sca/samples/helloworld-web-callback/src/main/webapp/hello.html b/java/sca/samples/helloworld-web-callback/src/main/webapp/hello.html deleted file mode 100644 index a52cd5d59e..0000000000 --- a/java/sca/samples/helloworld-web-callback/src/main/webapp/hello.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Apache Tuscany Helloworld Web2.0 Callbacks Sample - - - - - - - -

Apache Tuscany Helloworld Web2.0 Callbacks Sample

- - - - - - - - - - - - -
Enter your name: - -
- -
-
-
- - - diff --git a/java/sca/samples/helloworld-web/pom.xml b/java/sca/samples/helloworld-web/pom.xml deleted file mode 100644 index 48160e795a..0000000000 --- a/java/sca/samples/helloworld-web/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-web - war - Apache Tuscany SCA Helloworld Web Sample - - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-web-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldService.java b/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldService.java deleted file mode 100644 index 2b92fd4661..0000000000 --- a/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldService.java +++ /dev/null @@ -1,7 +0,0 @@ -package sample; - -public interface HelloworldService { - - String sayHello(String name); - -} diff --git a/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java b/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java deleted file mode 100644 index 2664e75188..0000000000 --- a/java/sca/samples/helloworld-web/src/main/java/sample/HelloworldServiceImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package sample; - -import org.oasisopen.sca.annotation.Service; - -@Service(HelloworldService.class) -public class HelloworldServiceImpl implements HelloworldService { - - public String sayHello(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite b/java/sca/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite deleted file mode 100644 index 20cebc2d53..0000000000 --- a/java/sca/samples/helloworld-web/src/main/webapp/META-INF/sca-deployables/web.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index f29262a147..0000000000 --- a/java/sca/samples/helloworld-web/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Apache Tuscany Helloworld Servlet Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - hello.html - - - diff --git a/java/sca/samples/helloworld-web/src/main/webapp/hello.html b/java/sca/samples/helloworld-web/src/main/webapp/hello.html deleted file mode 100644 index f7f8b2d4a9..0000000000 --- a/java/sca/samples/helloworld-web/src/main/webapp/hello.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - Apache Tuscany Helloworld Web Sample - - - - - - - -

Apache Tuscany Helloworld Web Sample

- - - - - - - - - - - - -
Enter your name: - -
- -
-
-
- - - diff --git a/java/sca/samples/helloworld-ws-deep-webapp/README b/java/sca/samples/helloworld-ws-deep-webapp/README deleted file mode 100644 index 66040004f8..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/README +++ /dev/null @@ -1 +0,0 @@ -http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl diff --git a/java/sca/samples/helloworld-ws-deep-webapp/build.xml b/java/sca/samples/helloworld-ws-deep-webapp/build.xml deleted file mode 100644 index bdb341d26a..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/build.xml +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-deep-webapp/pom.xml b/java/sca/samples/helloworld-ws-deep-webapp/pom.xml deleted file mode 100644 index 0595f43ec2..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - - - sample-helloworld-ws-service-webapp - Apache Tuscany SCA HelloWorld Web Service Sample Webapp - war - - - - org.apache.tuscany.sca - tuscany-sca-api - 2.0-SNAPSHOT - provided - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index a75187f0d7..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 18f74b083f..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite deleted file mode 100644 index 114608e4d8..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/META-INF/sca-deployables/helloworldws.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 0b95fbd14f..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 182fd38fd9..0000000000 --- a/java/sca/samples/helloworld-ws-deep-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - Apache Tuscany HelloWorld Web Service Sample - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/README b/java/sca/samples/helloworld-ws-reference-jms/README deleted file mode 100644 index abf10ef1f2..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/README +++ /dev/null @@ -1,127 +0,0 @@ -Hello World Web Service References Sample -========================================= -This sample demonstrates an SCA reference that uses a web service binding running -over a JMS protocl. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens you need to run the server first -so open a command prompt, navigate to the helloworld-ws-service-jms sample directory -and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer - - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-jms.jar helloworld.HelloWorldJmsClient - - -Sample Overview ---------------- -The sample provides two components that are have a reference with a -web service binding. The binding refers to WSDL that identifies the service -exposed by the helloworld-ws-service-jms sample. - -helloworld-ws-reference-jms/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldJmsClient.java - starts the SCA Runtime and - deploys the helloworldwsjmsclient - .composite. It then calls the - HelloWorldServiceComponent - resources/ - wsdl - helloworld.wsdl - the service description that the - SCA reference uses to bind to - helloworldwsjmsclient.composite - the SCA assembly for this sample - helloworldwsjms.composite - the SCA assembly for the server - that is used by the JUnit tests - logging.properties - log4j configuration file - test/ - java/ - helloworld/ - HelloWorldJMSClientTestCase.java - JUnit test case - helloworld-ws-reference.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. Before -you do this start up the service that the reference will talk to. To do this -run up the helloworld-ws-service-jms test. Take a look at the README in that sample -and you will see you need the following commands - -cd helloworld-ws-service-jms -ant run - -Once done you can now compile and run this sample using the following commands; - -cd helloworld-ws-reference-jms -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-service-jms sample first as the JUnit test does this for you. - -cd helloworld-ws-reference-jms -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldJmsClientTestCase -08-Jan-2008 10:40:15 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide -r start -INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu -eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active -MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619 -Injected helloWorldService -Called getGreetings -Injected helloWorldService -Called getGreetings -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 11.89 sec - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-reference-jms/build.xml b/java/sca/samples/helloworld-ws-reference-jms/build.xml deleted file mode 100644 index 4f83c8ae9d..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png b/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png deleted file mode 100644 index bd2bba41db..0000000000 Binary files a/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg b/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg deleted file mode 100644 index 333ad53e0a..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/helloworld-ws-reference.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldwsclient - - HelloWorldServiceComponent - - - HelloWorldService - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/pom.xml b/java/sca/samples/helloworld-ws-reference-jms/pom.xml deleted file mode 100644 index d1e77ca628..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-reference-jms - Apache Tuscany SCA HelloWorld Web Service Reference JMS Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-helloworld-ws-service-jms - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - org.apache.activemq - apache-activemq - 4.1.1 - test - - - org.apache.activemq - activemq-web-demo - - - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 2186c00e57..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java b/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java deleted file mode 100644 index b3db243a1f..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldJmsClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate the HelloWorld service and invoke it. - */ -public class HelloWorldJmsClient { - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsjmsclient.composite"); - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 8255364e99..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java deleted file mode 100644 index 0dee19550b..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/java/helloworld/HelloWorldServiceComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld service implementation - */ -public class HelloWorldServiceComponent implements HelloWorldService { - - HelloWorldService helloWorldService; - - public String getGreetings(String name) { - System.out.println("Called getGreetings"); - return helloWorldService.getGreetings(name); - } - - public HelloWorldService getHelloWorldService() { - System.out.println("Got Injected helloWorldService"); - return helloWorldService; - } - - public void setHelloWorldService(HelloWorldService helloWorldService) { - System.out.println("Injected helloWorldService"); - this.helloWorldService = helloWorldService; - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite b/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite deleted file mode 100644 index d029ba3e1c..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjms.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite b/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite deleted file mode 100644 index a4eb217310..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/helloworldwsjmsclient.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties b/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties deleted file mode 100644 index 3dca310cdb..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev$ $Date$ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 013a55b61e..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java b/java/sca/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java deleted file mode 100644 index 12b0716b5d..0000000000 --- a/java/sca/samples/helloworld-ws-reference-jms/src/test/java/helloworld/HelloWorldJmsClientTestCase.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - - -/** - * Test case for helloworld web service client - */ -public class HelloWorldJmsClientTestCase { - - private HelloWorldService helloWorldService; - private HelloWorldService helloTuscanyService; - private SCADomain scaClientDomain; - private SCADomain scaServiceDomain; - private BrokerService jmsBroker; - - - @Before - public void startClient() throws Exception { - try { - startBroker(); - scaServiceDomain = SCADomain.newInstance("helloworldwsjms.composite"); - scaClientDomain = SCADomain.newInstance("helloworldwsjmsclient.composite"); - helloWorldService = scaClientDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - helloTuscanyService = scaClientDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testWSClient() throws Exception { - String msg = helloWorldService.getGreetings("Smith"); - Assert.assertEquals("Hello Smith", msg); - msg = helloTuscanyService.getGreetings("Green"); - Assert.assertEquals("Hello Green", msg); - - Thread.sleep(2000); - } - - - @After - public void stopClient() throws Exception { - scaServiceDomain.close(); - scaClientDomain.close(); - if (jmsBroker != null) { - jmsBroker.stop(); - } - } - - protected void startBroker() throws Exception { - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - } -} diff --git a/java/sca/samples/helloworld-ws-reference-lean/README b/java/sca/samples/helloworld-ws-reference-lean/README deleted file mode 100644 index 13c89ab2f6..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/README +++ /dev/null @@ -1,178 +0,0 @@ -Hello World Web Service References Sample -========================================= -This sample demonstrates an SCA reference that uses a web service binding. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens you need to run the server first -so open a command prompt, navigate to the helloworld-ws-service sample directory -and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer - - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient - - -Sample Overview ---------------- -The sample provides a single component that is wired to a reference with a -web service binding. The binding refers to WSDL that identifies the service -exposed by the helloworld-ws-service sample. - -helloworld-ws-reference/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldClient.java - starts the SCA Runtime and - deploys the helloworldwsclient - .composite. It then calls the - HelloWorldServiceComponent - resources/ - wsdl - helloworld.wsdl - the service description that the - SCA reference uses to bind to - helloworldwsclient.composite - the SCA assembly for this sample - logging.properties - log4j configuration file - test/ - java/ - helloworld/ - HelloWorldClientTestCase.java - JUnit test case - HelloWorldServerTest.java - starts the Web service - helloworld-ws-reference.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. Before -you do this start up the service that the reference will talk to. To do this -run up the helloworld-ws-service test. Take a look at the README in that sample -and you will see you need the following commands - -cd helloworld-ws-service -ant run - -Once done you can now compile and run this sample using the following commands; - -cd helloworld-ws-reference -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-service sample first as Maven does this for you. - -cd helloworld-ws-reference -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldClientTestCase -14-Jan-2008 14:06:12 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:06:12 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/xml.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client -_1_1.xsd -14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:12 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService -Injected helloWorldService -Called getGreetings -14-Jan-2008 14:06:14 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:06:17 org.apache.catalina.loader.WebappLoader start -INFO: Dual registration of jndi stream handler: factory already defined -14-Jan-2008 14:06:17 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/xml.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client -_1_1.xsd -14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService -Injected helloWorldService -Called getGreetings -14-Jan-2008 14:06:18 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.625 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png b/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png deleted file mode 100644 index bd2bba41db..0000000000 Binary files a/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg b/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg deleted file mode 100644 index 354ffbae8f..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/helloworld-ws-reference.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldwsclient - - HelloWorldServiceComponent - - - HelloWorldService - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/pom.xml b/java/sca/samples/helloworld-ws-reference-lean/pom.xml deleted file mode 100644 index ff6907f223..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-reference-lean - Apache Tuscany SCA HelloWorld Web Service Reference Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-helloworld-ws-service - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index 7839c2366b..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * The HelloWorld client implementation - */ -@Scope("COMPOSITE") @EagerInit -public class HelloWorldClient { - - static HelloWorldService helloWorldService; - - @Reference - public void setHelloWorldService(HelloWorldService service) { - helloWorldService = service; - } - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - scaDomain.close(); - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java deleted file mode 100644 index 137894c469..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient2.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * The HelloWorld client implementation - */ -@Scope("COMPOSITE") @EagerInit -public class HelloWorldClient2 { - - private static HelloWorldClient2 client; - - @Reference - public HelloWorldService helloWorldService; - - public HelloWorldClient2() { - client = this; - } - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient2.composite"); - - client.doit(args); - - scaDomain.close(); - } - - void doit(String[] args) { - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java deleted file mode 100644 index 663aa4c852..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient3.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * The HelloWorld client implementation - */ -@Scope("COMPOSITE") @EagerInit -public class HelloWorldClient3 { - - @Reference - public HelloWorldService helloWorldService; - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient3.composite"); - - scaDomain.getService(HelloWorldClient3.class, "HelloWorldClient3").doit(args); - - scaDomain.close(); - } - - public void doit(String[] args) { - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java deleted file mode 100644 index d246225c76..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient4.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.oasisopen.sca.ComponentContext; -import org.oasisopen.sca.annotation.Context; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Scope; - -/** - * The HelloWorld client implementation - */ -@Scope("COMPOSITE") @EagerInit -public class HelloWorldClient4 { - - static ComponentContext clientContext; - - @Context - public void setContext(ComponentContext context) { - clientContext = context; - } - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient4.composite"); - - HelloWorldService helloWorldService = clientContext.getService(HelloWorldService.class, "helloWorldService"); - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - scaDomain.close(); - } - - public void doit(String[] args) { - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java deleted file mode 100644 index 5113a98530..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldClient5.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.oasisopen.sca.annotation.EagerInit; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -/** - * The HelloWorld client implementation - */ -@Scope("COMPOSITE") @EagerInit -public class HelloWorldClient5 { - - @Reference - public HelloWorldService helloWorldService; - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient5.composite"); - - scaDomain.close(); - } - - @Init - public void doit() { - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 8255364e99..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite deleted file mode 100644 index 991e4b4881..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite deleted file mode 100644 index 6ea14602b3..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient2.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite deleted file mode 100644 index 3d6364f55f..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient3.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite deleted file mode 100644 index 106e9db988..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient4.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite deleted file mode 100644 index bbac4c3703..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/helloworldwsclient5.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties deleted file mode 100644 index 3dca310cdb..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev$ $Date$ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 662c9affac..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java deleted file mode 100644 index 51b70f47c2..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldClientTestCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Test case for helloworld web service client - */ -public class HelloWorldClientTestCase extends HelloWorldClient { - - private SCADomain scaDomain; - private SCATestCaseRunner server; - - @Before - public void startClient() throws Exception { - scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - - server = new SCATestCaseRunner(HelloWorldTestServer.class); - server.before(); - } - - @Test - public void testWSClient() throws Exception { - String msg = helloWorldService.getGreetings("Smith"); - Assert.assertEquals("Hello Smith", msg); - } - - @After - public void stopClient() throws Exception { - server.after(); - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java deleted file mode 100644 index 8226ec884e..0000000000 --- a/java/sca/samples/helloworld-ws-reference-lean/src/test/java/helloworld/HelloWorldTestServer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Starts up the SCA runtime which starts listening for service requests - */ -public class HelloWorldTestServer { - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - try { - scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-reference-secure/README b/java/sca/samples/helloworld-ws-reference-secure/README deleted file mode 100644 index 167991c8f7..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/README +++ /dev/null @@ -1,176 +0,0 @@ -Hello World Secure Web Service References Sample -================================================ -This sample demonstrates an SCA reference that uses a web service binding. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens you need to run the server first -so open a command prompt, navigate to the helloworld-ws-service sample directory -and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer - - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference-secure.jar helloworld.HelloWorldClient - - -Sample Overview ---------------- -The sample provides a single component that is wired to a reference with a -web service binding. The binding refers to WSDL that identifies the service -exposed by the helloworld-ws-service-secure sample. This sample invokes a -secure web-serivce and hence specifies a policy intent named 'authentication' -which is fulfilled by a suitable policyset that is defined for the SCA Domain. -Over the helloworld-ws-reference sample, this sample demonstrate generally -the use of policy intents and policy sets in Tuscany taking the specific instance -of a security policy. - -Note : ------- -The policies mentioned and supported are instances of Tuscany specified policies and -not instnaces of WS-Policy. - -helloworld-ws-reference-secure/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldClient.java - starts the SCA Runtime and - deploys the helloworldwsclient - .composite. It then calls the - HelloWorldServiceComponent - ClientPWCBHandler.java - Callback handler class to provide client password. The - handle(Callback[] callbacks) method of this class is where - code for accessing user registries and retrieving passwords - for given user identifiers can be encapsulated. For example - here is where one could access LDAP registries to obtain or - compare user identities and passwords. - - resources/ - wsdl - helloworld.wsdl - the service description that the - SCA reference uses to bind to - helloworldwsclient.composite - the SCA assembly for this sample - logging.properties - log4j configuration file - definitions.xml - the SCA Definitions file that contains intents and policysets - defined for the SCA Domain - test/ - java/ - helloworld/ - HelloWorldClientTestCase.java - JUnit test case - HelloWorldServerTest.java - starts the Web service - helloworld-ws-reference-secure.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. Before -you do this start up the service that the reference will talk to. To do this -run up the helloworld-ws-service-secure test. Take a look at the README in that sample -and you will see you need the following commands - -cd helloworld-ws-service-secure -ant run - -Once done you can now compile and run this sample using the following commands; - -cd helloworld-ws-reference-secure -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Injected helloWorldService - [java] Called getGreetings - [java] *** Calling Client UserId/Password Handler .... - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-service-secure sample first as Maven does this for you. - -cd helloworld-ws-reference-secure -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldClientTestCase -log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX -Utils). -log4j:WARN Please initialize the log4j system properly. -log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX -Utils). -log4j:WARN Please initialize the log4j system properly. -10-May-2007 13:40:34 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -10-May-2007 13:40:35 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/xml.xsd -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -10-May-2007 13:40:35 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client -_1_1.xsd -10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -10-May-2007 13:40:35 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -Injected helloWorldService -Called getGreetings -*** Calling Client UserId/Password Handler .... -*** Calling Server User/Passwd Handler.... -10-May-2007 13:40:36 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.349 sec - -Results : - - -This shows that the Junit test cases have run successfully. Also note that the client side and server side -callback handlers for authentication have been called. diff --git a/java/sca/samples/helloworld-ws-reference-secure/build.xml b/java/sca/samples/helloworld-ws-reference-secure/build.xml deleted file mode 100644 index 38f1b7549d..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png b/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png deleted file mode 100644 index bd2bba41db..0000000000 Binary files a/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg b/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg deleted file mode 100644 index 333ad53e0a..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/helloworld-ws-reference-secure.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldwsclient - - HelloWorldServiceComponent - - - HelloWorldService - - diff --git a/java/sca/samples/helloworld-ws-reference-secure/pom.xml b/java/sca/samples/helloworld-ws-reference-secure/pom.xml deleted file mode 100644 index 5694276870..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-reference-secure - Apache Tuscany SCA HelloWorld Secure Web Service Reference Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.ws.security - wss4j - 1.5.3 - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-helloworld-ws-service-secure - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java b/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java deleted file mode 100644 index 0f1ebf46d6..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/ClientPWCBHandler.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.ws.security.WSPasswordCallback; - -/** - * Sample userid passwd generation class - */ -public class ClientPWCBHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - System.out.println("*** Calling Client UserId/Password Handler .... "); - WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; - System.out.println("User Id = " + pwcb.getIdentifer()); - pwcb.setPassword("TuscanyWsUserPasswd"); - System.out.println("Set Password = " + pwcb.getPassword()); - } - } - -} diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java b/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index a21619fc8a..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate the HelloWorld service and invoke it. - */ -public class HelloWorldClient { - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldWsPolicyServiceComponent"); - value = helloWorldService.getGreetings("WsPolicyWorld"); - System.out.println(value); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index ca7c90f23e..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java deleted file mode 100644 index 27cef47677..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/java/helloworld/HelloWorldServiceComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld service implementation - */ -public class HelloWorldServiceComponent implements HelloWorldService { - - HelloWorldService helloWorldService; - - public String getGreetings(String name) { - System.out.println("Called getGreetings"); - return helloWorldService.getGreetings(name); - } - - public HelloWorldService getHelloWorldService() { - System.out.println("Got Injected helloWorldService"); - return helloWorldService; - } - - public void setHelloWorldService(HelloWorldService helloWorldService) { - System.out.println("Injected helloWorldService"); - this.helloWorldService = helloWorldService; - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler deleted file mode 100644 index 8b089c7222..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures -# handler classname;qname=;model= -org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://helloworld#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy -org.apache.tuscany.sca.policy.security.ws.WSSecurityPolicyHandler;intent=http://helloworld#wsIntegrity,model=org.apache.neethi.Policy \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml deleted file mode 100644 index 0ab3a5a9f1..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/definitions.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - - - - - - - UsernameToken - TuscanyWsUser - helloworld.ClientPWCBHandler" + - PasswordText - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TuscanyWsUser - TuscanyWsUser - helloworld.ClientPWCBHandler - - - - JKS - helloworldKeys.jks - TuscanyWsUserPasswd - - - - - - - - - - - - - - - - - UsernameToken - helloworld.ServerPWCBHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TuscanyWsUser - TuscanyWsUser - helloworld.ServerPWCBHandler - - - - JKS - helloworldKeys.jks - TuscanyWsUserPasswd - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks deleted file mode 100644 index 0b4f2399f0..0000000000 Binary files a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldKeys.jks and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite deleted file mode 100644 index 904befaf60..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/helloworldwsclient.composite +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties deleted file mode 100644 index 3a4b43222d..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev: 463856 $ $Date: 2006-10-14 03:54:29 +0530 (Sat, 14 Oct 2006) $ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index e6fcc6f4a6..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java deleted file mode 100644 index 848c41d1c7..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldClientTestCase.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Test case for helloworld web service client - */ -public class HelloWorldClientTestCase { - - private HelloWorldService helloWorldService; - private HelloWorldService helloTuscanyService; - private SCADomain scaDomain; - - private SCATestCaseRunner server; - - @Before - public void startClient() throws Exception { - try { - scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); - - server = new SCATestCaseRunner(HelloWorldTestServer.class); - server.before(); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testWSClient() throws Exception { - String msg = helloWorldService.getGreetings("Smith"); - Assert.assertEquals("Hello Smith", msg); - } - - @Test - public void testEmbeddedReferenceClient() throws Exception { - String msg = helloTuscanyService.getGreetings("Tuscany"); - Assert.assertEquals("Hello Tuscany", msg); - } - - @After - public void stopClient() throws Exception { - server.after(); - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java deleted file mode 100644 index 21f2166560..0000000000 --- a/java/sca/samples/helloworld-ws-reference-secure/src/test/java/helloworld/HelloWorldTestServer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Starts up the SCA runtime which starts listening for service requests - */ -public class HelloWorldTestServer { - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - try { - scaDomain = SCADomain.newInstance("helloworldws.composite"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-reference/README b/java/sca/samples/helloworld-ws-reference/README deleted file mode 100644 index 13c89ab2f6..0000000000 --- a/java/sca/samples/helloworld-ws-reference/README +++ /dev/null @@ -1,178 +0,0 @@ -Hello World Web Service References Sample -========================================= -This sample demonstrates an SCA reference that uses a web service binding. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens you need to run the server first -so open a command prompt, navigate to the helloworld-ws-service sample directory -and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer - - -Once the server is running open a command prompt, navigate to this sample -directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-reference.jar helloworld.HelloWorldClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-reference.jar helloworld.HelloWorldClient - - -Sample Overview ---------------- -The sample provides a single component that is wired to a reference with a -web service binding. The binding refers to WSDL that identifies the service -exposed by the helloworld-ws-service sample. - -helloworld-ws-reference/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldClient.java - starts the SCA Runtime and - deploys the helloworldwsclient - .composite. It then calls the - HelloWorldServiceComponent - resources/ - wsdl - helloworld.wsdl - the service description that the - SCA reference uses to bind to - helloworldwsclient.composite - the SCA assembly for this sample - logging.properties - log4j configuration file - test/ - java/ - helloworld/ - HelloWorldClientTestCase.java - JUnit test case - HelloWorldServerTest.java - starts the Web service - helloworld-ws-reference.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant. Before -you do this start up the service that the reference will talk to. To do this -run up the helloworld-ws-service test. Take a look at the README in that sample -and you will see you need the following commands - -cd helloworld-ws-service -ant run - -Once done you can now compile and run this sample using the following commands; - -cd helloworld-ws-reference -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-service sample first as Maven does this for you. - -cd helloworld-ws-reference -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldClientTestCase -14-Jan-2008 14:06:12 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:06:12 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/xml.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:06:12 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client -_1_1.xsd -14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:12 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:12 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService -Injected helloWorldService -Called getGreetings -14-Jan-2008 14:06:14 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:06:17 org.apache.catalina.loader.WebappLoader start -INFO: Dual registration of jndi stream handler: factory already defined -14-Jan-2008 14:06:17 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_1_4.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/xml.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/web-app_2_4.xsd -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:06:17 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_client -_1_1.xsd -14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:06:17 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService -Injected helloWorldService -Called getGreetings -14-Jan-2008 14:06:18 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.625 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-reference/build.xml b/java/sca/samples/helloworld-ws-reference/build.xml deleted file mode 100644 index 71ee66b31e..0000000000 --- a/java/sca/samples/helloworld-ws-reference/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.png b/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.png deleted file mode 100644 index bd2bba41db..0000000000 Binary files a/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.svg b/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.svg deleted file mode 100644 index 354ffbae8f..0000000000 --- a/java/sca/samples/helloworld-ws-reference/helloworld-ws-reference.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldwsclient - - HelloWorldServiceComponent - - - HelloWorldService - - diff --git a/java/sca/samples/helloworld-ws-reference/pom.xml b/java/sca/samples/helloworld-ws-reference/pom.xml deleted file mode 100644 index 175f7f7038..0000000000 --- a/java/sca/samples/helloworld-ws-reference/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-reference - Apache Tuscany SCA HelloWorld Web Service Reference Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-helloworld-ws-service - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java b/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index 4559b282fe..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate the HelloWorld service and invoke it. - */ -public class HelloWorldClient { - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - String value = helloWorldService.getGreetings("World"); - System.out.println(value); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 8255364e99..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java deleted file mode 100644 index 0dee19550b..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/java/helloworld/HelloWorldServiceComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld service implementation - */ -public class HelloWorldServiceComponent implements HelloWorldService { - - HelloWorldService helloWorldService; - - public String getGreetings(String name) { - System.out.println("Called getGreetings"); - return helloWorldService.getGreetings(name); - } - - public HelloWorldService getHelloWorldService() { - System.out.println("Got Injected helloWorldService"); - return helloWorldService; - } - - public void setHelloWorldService(HelloWorldService helloWorldService) { - System.out.println("Injected helloWorldService"); - this.helloWorldService = helloWorldService; - } -} \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite b/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite deleted file mode 100644 index 899ad5ce35..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/resources/helloworldwsclient.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference/src/main/resources/logging.properties b/java/sca/samples/helloworld-ws-reference/src/main/resources/logging.properties deleted file mode 100644 index 3dca310cdb..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev$ $Date$ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 662c9affac..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java deleted file mode 100644 index 7ce89179c2..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldClientTestCase.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Test case for helloworld web service client - */ -public class HelloWorldClientTestCase { - - private HelloWorldService helloWorldService; - private HelloWorldService helloTuscanyService; - private SCADomain scaDomain; - - private SCATestCaseRunner server; - - @Before - public void startClient() throws Exception { - try { - scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - helloTuscanyService = scaDomain.getService(HelloWorldService.class, "HelloTuscanyServiceComponent"); - - server = new SCATestCaseRunner(HelloWorldTestServer.class); - server.before(); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testWSClient() throws Exception { - String msg = helloWorldService.getGreetings("Smith"); - Assert.assertEquals("Hello Smith", msg); - } - - @Test - public void testEmbeddedReferenceClient() throws Exception { - String msg = helloTuscanyService.getGreetings("Tuscany"); - Assert.assertEquals("Hello Tuscany", msg); - } - - @After - public void stopClient() throws Exception { - server.after(); - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java deleted file mode 100644 index 8226ec884e..0000000000 --- a/java/sca/samples/helloworld-ws-reference/src/test/java/helloworld/HelloWorldTestServer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Starts up the SCA runtime which starts listening for service requests - */ -public class HelloWorldTestServer { - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - try { - scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/README b/java/sca/samples/helloworld-ws-sdo-webapp/README deleted file mode 100644 index aa4819927a..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/README +++ /dev/null @@ -1,92 +0,0 @@ -Hello World Web Service SDO WebApp Sample -========================================= -This sample demonstrates an SCA web service binding which works with -SDO and runs as a web application. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is is built and copied to your web app container. -See the sections below for instructions on building the war. - -Once the web app is deployed use your browser to visit the following URL; - - http://localhost:8080/sample-helloworld-ws-sdo-webapp - -The port and hostname will of course vary depending on your local installation. - -The resulting web page displayed should show: - - Hello John Smith, Jane Doe! - -Sample Overview ---------------- -The sample builds a war with a single JSP (HelloWorld.jsp). This JSP -calls an SCA component with an SDO parameter. This in turn calls another -SCA component with the SDO parameter. The contents of the SDO are then -returned as a simple string. This sample shows how SDO objects can -be passed into and between services in the context of a web application. - - -helloworld-jsonrpc-webapp/ - src/ - main/ - java/ - helloworld/ - HelloWorld.java - service interface - HelloWorldComponent.java - first service implementation - HelloWorldmpl.java - second service implementation - resources/ - wsdl/ - helloworld.wsdl - the web services description - helloworld.xsd - the SDO description - helloworldws.composite - the SCA assembly for this sample - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime - HelloWorld.jsp - the web application that calls the - SCA service passing in an SDO - - helloworld-ws-sdo-webapp.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd helloworld-ws-sdo-webapp -ant package - -This should result in a war file (sample-helloworld-ws-sdo-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in your -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-helloworld-ws-sdo-webapp - -The port and hostname will of course vary depending on your local installation. - -Building The Sample Using Maven -------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-service sample first as Maven does this for you. - -cd helloworld-ws-sdo-webapp -mvn - -That should end with "BUILD SUCCESSFUL" and create the target/sample-helloworld-ws-sdo-webapp.war -which you can copy to your server. diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/build.xml b/java/sca/samples/helloworld-ws-sdo-webapp/build.xml deleted file mode 100644 index 386008e707..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/build.xml +++ /dev/null @@ -1,99 +0,0 @@ - - -]> - - - &buildDependency; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png b/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png deleted file mode 100644 index 2590f02a45..0000000000 Binary files a/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg b/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg deleted file mode 100644 index 56a29db23c..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/helloworld-ws-sdo-webapp.svg +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - - - HelloWorldImpl - - - SDO - HelloWorld.jsp - - - sample-helloworld-ws-sdo-webapp.war - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/pom.xml b/java/sca/samples/helloworld-ws-sdo-webapp/pom.xml deleted file mode 100644 index d714663dc8..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/pom.xml +++ /dev/null @@ -1,200 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-sdo-webapp - war - Apache Tuscany SCA HelloWorld Web Service SDO Sample WebApp - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sdo - tuscany-sdo-api-r2.1 - 1.1.1 - - - org.apache.tuscany.sdo - tuscany-sdo-lib - 1.1.1 - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1.1 - - - org.apache.tuscany.sca - tuscany-databinding-sdo - 2.0-SNAPSHOT - compile - - - - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - junit - junit - 4.5 - test - - - - org.codehaus.woodstox - wstx-asl - 3.2.1 - runtime - - - - - - ${artifactId} - - - org.codehaus.mojo - build-helper-maven-plugin - 1.0 - - - add-source - generate-sources - - add-test-source - - - - target/sdo-source - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1.1 - - - generate-helloworld-sdo - generate-sources - - - - ${basedir}/src/main/resources/wsdl/helloworld.xsd - helloworld.type - Type - true - - - ${basedir}/src/main/resources/wsdl/helloworld.wsdl - helloworld - Helloworld - true - - - - - generate - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - true - - - generate - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java deleted file mode 100644 index 3123223cd3..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorld.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * HelloWorld.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: #axisVersion# #today# - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/* - * HelloWorld java interface - */ - -@Remotable -public interface HelloWorld { - - /** - * Auto generated method signatures - * - * @param getGreetings - */ - public java.lang.String getGreetings(helloworld.Party getGreetings); - -} diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java deleted file mode 100644 index fea4e2a16c..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldComponent.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - - -public class HelloWorldComponent implements HelloWorld { - - HelloWorld helloWorld; - - public String getGreetings(Party party) { - System.out.println("Called getGreetings"); - return helloWorld.getGreetings(party); - } - - public HelloWorld getHelloWorld() { - System.out.println("Got Injected helloWorld"); - return helloWorld; - } - - public void setHelloWorld(HelloWorld helloWorld) { - System.out.println("Injected helloWorld"); - this.helloWorld = helloWorld; - } -} diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index ed99edb2a2..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.util.List; - -import org.oasisopen.sca.annotation.Service; - -@Service(HelloWorld.class) -public class HelloWorldImpl implements HelloWorld { - - public String getGreetings(Party party) { - System.out.println("Greeting party"); - StringBuffer greetings = new StringBuffer(); - greetings.append("Hello "); - List people = party.getPeople(); - int i=0; - for (Person person : people) { - greetings.append(person.getFirstName()); - greetings.append(" "); - greetings.append(person.getLastName()); - i++; - if (i < people.size()) { - greetings.append(", "); - } - } - greetings.append("!"); - - return greetings.toString(); - } - -} diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite deleted file mode 100644 index 34396b1b02..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/helloworldws.composite +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index fe79094b94..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd deleted file mode 100644 index a0b7c37cd9..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/resources/wsdl/helloworld.xsd +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp deleted file mode 100644 index 4657c6cdc1..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/HelloWorld.jsp +++ /dev/null @@ -1,48 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> -<%@ page import="helloworld.HelloWorld" %> -<%@ page import="helloworld.HelloworldFactory"%> -<%@ page import="helloworld.Party"%> -<%@ page import="helloworld.Person"%> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - HelloWorld helloWorld = (HelloWorld)scaDomain.getService(HelloWorld.class, "HelloWorldServiceComponent"); -%> - -Hello World SDO sample - - -<% - Party party = HelloworldFactory.INSTANCE.createParty(); - Person person = HelloworldFactory.INSTANCE.createPerson(); - person.setFirstName("John"); - person.setLastName("Smith"); - party.getPeople().add(person); - person = HelloworldFactory.INSTANCE.createPerson(); - person.setFirstName("Jane"); - person.setLastName("Doe"); - party.getPeople().add(person); -%> -<%= helloWorld.getGreetings(party) %> - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 6f241cc90c..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index b7a7df2c17..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-helloworld-ws-sdo-webapp - 2.0-SNAPSHOT - war - - - - - org.apache.geronimo.configs - sharedlib - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 257e65aad4..0000000000 --- a/java/sca/samples/helloworld-ws-sdo-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - Apache Tuscany Hello World Web Service SDO Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - tuscany - /services/* - - - - HelloWorld.jsp - - - diff --git a/java/sca/samples/helloworld-ws-sdo/README b/java/sca/samples/helloworld-ws-sdo/README deleted file mode 100644 index be947b1923..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/README +++ /dev/null @@ -1,214 +0,0 @@ -Hello World Web Service References using SDO Sample -=================================================== -This sample demonstrates an SCA reference that uses a web service binding which works with SDO. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -To run this sample ------------------- -This sample is dependent on helloworld-ws-service. Open a command prompt to start -the service. If you are running ant do the following: - -cd helloworld-ws-service -ant run - -if you don't have ant, issue one of the following commands for windows or *nix: - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service.jar helloworld.HelloWorldServer - -You should see the following output: - -Buildfile: build.xml - -run-server: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Aug 24, 2007 11:17:33 AM org.apache.catalina.core.StandardEngine sta -rt - [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.ContextConfig d -efaultWebConfig - [java] INFO: No default web.xml - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory - register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0. -xsd - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory - register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_1_1.dtd - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory - register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_1_2.dtd - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory - register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jspt -aglibrary_2_0.xsd - [java] Aug 24, 2007 11:17:34 AM org.apache.catalina.startup.DigesterFactory - register - [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_ser -vices_1_1.xsd - [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol ini -t - [java] INFO: Initializing Coyote HTTP/1.1 on http-8085 - [java] Aug 24, 2007 11:17:34 AM org.apache.coyote.http11.Http11Protocol sta -rt - [java] INFO: Starting Coyote HTTP/1.1 on http-8085 - [java] Aug 24, 2007 11:17:34 AM org.apache.tuscany.sca.http.tomcat.TomcatSe -rver addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService - - [java] HelloWorld server started (press enter to shutdown) - -The server is now ready. - - -Now, open another command window to run the client. - -cd helloworld-ws-sdo -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-sdo.jar helloworld.HelloWorldClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-sdo.jar helloworl.HelloWorldClient - -You should be able to see the following result: - -Buildfile: build.xml - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello David Haney - -BUILD SUCCESSFUL -Total time: 9 seconds - - -Sample Overview ---------------- -The sample provides a single component that is wired to a reference with a -web service binding. The binding refers to WSDL that identifies the service -exposed by the helloworld-ws-service sample. - -helloworld-ws-sdo/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldServiceComponent.java - component implementation - HelloWorldClient.java - starts the SCA Runtime and - deploys the helloworldwsclient - .composite. It then calls the - HelloWorldServiceComponent - resources/ - wsdl - helloworld.wsdl - the service description that the - SCA reference uses to bind to service. - - test/ - java/ - helloworld/ - HelloWorldClientTestCase.java - JUnit test case - helloworld-ws-sdo.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -You can build and run the sample with the binary distribution using Ant. -Make sure that you have started helloworld-ws-service which this sample is dependent on -in a separate command window. You can either follow the instruction at the begining of this -sample file or if you want to build and run the service, follow the README under helloworld-ws-service. - -Now, let's build and run helloworld-ws-sdo sample: - -cd helloworld-ws-sdo -ant -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] Injected helloWorldService - [java] Called getGreetings - [java] Hello World - -Building And Running The Sample Using Maven -------------------------------------------- -You can build and run the sample with either the binary or source distributions using Maven. Please note that you do not need to start helloworld-ws-service in this case since Maven does this for you. - -cd helloworld-ws-sdo -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldClientTestCase -log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX -Utils). -log4j:WARN Please initialize the log4j system properly. -log4j:WARN No appenders could be found for logger (org.apache.axiom.om.util.StAX -Utils). -log4j:WARN Please initialize the log4j system properly. -Aug 23, 2007 2:27:32 PM org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.ContextConfig defaultWebConf -ig -INFO: No default web.xml -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -1.dtd -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -2.dtd -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -Aug 23, 2007 2:27:32 PM org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -Aug 23, 2007 2:27:32 PM org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -Aug 23, 2007 2:27:32 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServl -etMapping -INFO: Added Servlet mapping: http://localhost:8085/HelloWorldService -Injected helloWorldService -Called getGreetings -Aug 23, 2007 2:27:34 PM org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.502 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-sdo/build.xml b/java/sca/samples/helloworld-ws-sdo/build.xml deleted file mode 100644 index 401315d424..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/build.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.png b/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.png deleted file mode 100644 index bd2bba41db..0000000000 Binary files a/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg b/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg deleted file mode 100644 index 333ad53e0a..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/helloworld-ws-sdo.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldwsclient - - HelloWorldServiceComponent - - - HelloWorldService - - diff --git a/java/sca/samples/helloworld-ws-sdo/pom.xml b/java/sca/samples/helloworld-ws-sdo/pom.xml deleted file mode 100644 index 23c16b4981..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/pom.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-sdo - Apache Tuscany SCA HelloWorld Web Service SDO Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sdo - tuscany-sdo-lib - 1.1.1 - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1.1 - - - org.apache.tuscany.sca - tuscany-databinding-sdo - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.codehaus.mojo - build-helper-maven-plugin - 1.0 - - - add-source - generate-sources - - add-test-source - - - - target/sdo-source - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1.1 - - - generate-helloworld-sdo - generate-sources - - ${basedir}/src/main/resources/wsdl/helloworld.wsdl - helloworld - Helloworld - true - true - true - - - generate - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java b/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java deleted file mode 100644 index de4795ceaf..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldClient.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, locate the - * HelloWorld service and invoke it. - */ -public class HelloWorldClient { - - public final static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - HelloWorldService helloWorldService = - scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - Name name = HelloworldFactory.INSTANCE.createName(); - - name.setFirst("David"); - name.setLast("Haney"); - - String value = helloWorldService.getGreetings(name); - System.out.println(value); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index c42a4d59c3..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(Name name) { - return "Hello " + name.getFirst() + " " + name.getLast(); - } - -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java b/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index e03ed4dc25..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - public static void main(String[] args) { - - SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); - - try { - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - System.out.println("HelloWorld server stopped"); - } - -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 0c3025f0c9..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the helloworld service - */ -@Remotable -public interface HelloWorldService { - public String getGreetings(Name name); -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java b/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java deleted file mode 100644 index 711eef63b5..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/java/helloworld/HelloWorldServiceComponent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -/** - * The HelloWorld service implementation - */ -public class HelloWorldServiceComponent implements HelloWorldService { - - HelloWorldService helloWorldService; - - public String getGreetings(Name name) { - System.out.println("Called getGreetings"); - return helloWorldService.getGreetings(name); - } - - public HelloWorldService getHelloWorldService() { - System.out.println("Got Injected helloWorldService"); - return helloWorldService; - } - - public void setHelloWorldService(HelloWorldService helloWorldService) { - System.out.println("Injected helloWorldService"); - this.helloWorldService = helloWorldService; - } -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite b/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite deleted file mode 100644 index c255df2897..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldws.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite b/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite deleted file mode 100644 index d4fba548d5..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/resources/helloworldwsclient.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/resources/logging.properties b/java/sca/samples/helloworld-ws-sdo/src/main/resources/logging.properties deleted file mode 100644 index 3dca310cdb..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/resources/logging.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# $Rev$ $Date$ -# - -# Custom logging configuration for Tuscany samples -# By default, only INFO level logging is enabled and ALL messages get sent to the console -# For more messages from the runtime, uncomment specific settings at the end of this file -handlers = java.util.logging.ConsoleHandler -java.util.logging.ConsoleHandler.level = ALL -java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter -.level=INFO - -# Uncomment the next setting to get all Tuscany messages (this will be a lot) -#org.apache.tuscany.level=FINEST diff --git a/java/sca/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 2ecc0bea43..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java b/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java deleted file mode 100644 index 11564c370f..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldClientTestCase.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -import junit.framework.Assert; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Test case for helloworld web service client - */ -public class HelloWorldClientTestCase { - - private HelloWorldService helloWorldService; - private SCADomain scaDomain; - - private SCATestCaseRunner server; - - @Before - public void startClient() throws Exception { - try { - scaDomain = SCADomain.newInstance("helloworldwsclient.composite"); - helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent"); - - server = new SCATestCaseRunner(HelloWorldTestServer.class); - server.before(); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testWSClient() throws Exception { - Name name = HelloworldFactory.INSTANCE.createName(); - name.setFirst("John"); - name.setLast("Smith"); - String msg = helloWorldService.getGreetings(name); - Assert.assertEquals("Hello John Smith", msg); - } - - @After - public void stopClient() throws Exception { - server.after(); - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java b/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java deleted file mode 100644 index 4b0c40dafd..0000000000 --- a/java/sca/samples/helloworld-ws-sdo/src/test/java/helloworld/HelloWorldTestServer.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Starts up the SCA runtime which starts listening for service requests - */ -public class HelloWorldTestServer { - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - try { - scaDomain = SCADomain.newInstance("helloworldws.composite"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-service-jms/README b/java/sca/samples/helloworld-ws-service-jms/README deleted file mode 100644 index 26272b1d91..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/README +++ /dev/null @@ -1,119 +0,0 @@ -Hello World SOAP/JMS Service Sample -=================================== -This sample demonstrates an SCA service that uses a web service binding using -a SOAP/JMS protocol - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-jms.jar helloworld.HelloWorldServer - -Now the server is started you can use the helloworld-ws-reference-jms sample to -exercise it. - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -web service binding. - -helloworld-ws-service-jms/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldImpl.java - component implementation - HelloWorldServer.java - starts the SCA Runtime and - deploys the helloworldwsjms - .composite and then waits for the - service to be called via web services - resources/ - wsdl/ - helloworld.wsdl - the service description that describes - the exposed service - helloworldwsjms.composite - the SCA assembly for this sample - helloworldwsjmspolicy.composite - shows how the protocol can be - selected using policy. Not run - by the sample - test/ - java/ - helloworld/ - HelloWorldJMSServerTestCase.java- JUnit test case - HelloWorldJMSPolicyServerTestCase.java- JUnit test case - helloworld-ws-service.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd helloworld-ws-service-jms -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] log4j:WARN No appenders could be found for logger (org.apache.axiom. -om.util.StAXUtils). - [java] log4j:WARN Please initialize the log4j system properly. - [java] HelloWorld server started (press enter to shutdown) - -As this point the SCA service is exposed as a web service by a web server -started automatically by the SCA runtime. To stop the server just press -enter. - -To exercise the service run up the helloworld-ws-reference-jms sample. Take a look at -the README in that sample and you will see you need the following commands - -cd helloworld-ws-reference-jms -ant run - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-reference-jms sample as Maven includes a simple ping test to make sure that the -service is available - -cd helloworld-ws-service-jms -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldJmsPolicyServerTestCase -08-Jan-2008 10:41:17 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide -r start -INFO: Axis2 JMS URL=jms:/HelloWorldServiceComponent?java.naming.factory.initial= -org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url= -tcp://localhost:61619&transport.jms.ConnectionFactoryJNDIName=QueueConnectionFac -tory -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 6.984 sec -Running helloworld.HelloWorldJmsServerTestCase -08-Jan-2008 10:41:22 org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvide -r start -INFO: Axis2 JMS URL=jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=Qu -eueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.Active -MQInitialContextFactory&java.naming.provider.url=tcp://localhost:61619 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.266 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-service-jms/build.xml b/java/sca/samples/helloworld-ws-service-jms/build.xml deleted file mode 100644 index 330de7f7e5..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.png b/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.png deleted file mode 100644 index eab29d0bcd..0000000000 Binary files a/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.svg b/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.svg deleted file mode 100644 index 8d2ae98c82..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/helloworld-ws-service.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - HelloWorldWebService - - diff --git a/java/sca/samples/helloworld-ws-service-jms/pom.xml b/java/sca/samples/helloworld-ws-service-jms/pom.xml deleted file mode 100644 index 90f3e7f297..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/pom.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-service-jms - Apache Tuscany SCA HelloWorld Web Service JMS Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - compile - - - - org.apache.activemq - activemq-core - 4.1.1 - compile - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 2186c00e57..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java b/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index 5454487ff6..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - protected static BrokerService startBroker() throws Exception { - BrokerService jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - return jmsBroker; - } - - public static void main(String[] args) throws Exception { - - BrokerService broker = startBroker(); - SCADomain scaDomain = SCADomain.newInstance("helloworldwsjms.composite"); - - try { - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - broker.stop(); - System.out.println("HelloWorld server stopped"); - // FIXME: Workaround for http://issues.apache.org/jira/browse/AXIS2-3685 - System.exit(0); - } - -} diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index a0081be22d..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} - diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml b/java/sca/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml deleted file mode 100644 index 8c881ab0bb..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/definitions.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - The general intent that a transport is available over which SOAP messages flow - - - - - - A JMS transport is required - - - - - - An HTTP transport is required - - - - - - - An HTTPS transport is required - - - - - - - org.apache.activemq.jndi.ActiveMQInitialContextFactory - tcp://localhost:61619 - QueueConnectionFactory - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite b/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite deleted file mode 100644 index 67079f738e..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjms.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite b/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite deleted file mode 100644 index 10faf374f3..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/helloworldwsjmspolicy.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 3f9e00689e..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java b/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java deleted file mode 100644 index 34f8605d5d..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsPolicyServerTestCase.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import java.io.IOException; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldJmsPolicyServerTestCase{ - - private SCADomain scaDomain; - private BrokerService jmsBroker; - - @Before - public void startServer() throws Exception { - startBroker(); - scaDomain = SCADomain.newInstance("helloworldwsjmspolicy.composite"); - } - - protected void startBroker() throws Exception { - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - if (jmsBroker != null) { - jmsBroker.stop(); - } - } -} diff --git a/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java b/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java deleted file mode 100644 index 03d566cc17..0000000000 --- a/java/sca/samples/helloworld-ws-service-jms/src/test/java/helloworld/HelloWorldJmsServerTestCase.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import java.io.IOException; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldJmsServerTestCase{ - - private SCADomain scaDomain; - private BrokerService jmsBroker; - - @Before - public void startServer() throws Exception { - startBroker(); - scaDomain = SCADomain.newInstance("helloworldwsjms.composite"); - } - - protected void startBroker() throws Exception { - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - if (scaDomain != null) { - scaDomain.close(); - } - if (jmsBroker != null) { - jmsBroker.stop(); - } - } - -} diff --git a/java/sca/samples/helloworld-ws-service-secure/README b/java/sca/samples/helloworld-ws-service-secure/README deleted file mode 100644 index f32eb08b05..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/README +++ /dev/null @@ -1,152 +0,0 @@ -Hello World Secure Web Service Service Sample -============================================= -This sample demonstrates an SCA service that uses a web service binding that is enabled for simple -authentication using UseridToken and PasswordText - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-helloworld-ws-service-secure.jar helloworld.HelloWorldServer - -Now the server is started you can use the helloworld-ws-reference-secure sample to -exercise it. - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -web service binding. The service specifies a policy intent named 'authentication' -which is fulfilled by a suitable policyset that is defined for the SCA Domain. Over -the helloworld-ws-service sample, this sample demonstrate generally the use of policy -intents and policy sets in Tuscany taking the specific instance of a security policy. - -Note : ------- -The policies mentioned and supported are instances of Tuscany specified policies and -not instnaces of WS-Policy. - -helloworld-ws-service-secure/ - src/ - main/ - java/ - helloworld/ - HelloWorldService.java - interface description for - HelloWorldServiceComponent - HelloWorldImpl.java - component implementation - HelloWorldServer.java - starts the SCA Runtime and - deploys the helloworldws - .composite and then waits for the - service to be called via web services - ServerPWCBHandler.java - callback handler to authenticate client userid and password. - The handle(Callback[] callbacks) method of this class typically contains - code for accessing user registries and retrieving passwords - for user identifiers sent by the client and verifying them - against the password sent by the client. For example - here is where one could access LDAP registries to obtain or - compare user identities and passwords. - resources/ - wsdl/ - helloworld.wsdl - the service description that describes - the exposed service - helloworldws.composite - the SCA assembly for this sample - definitions.xml - the SCA Definitions file that contains intents and policysets - defined for the SCA Domain - - helloworld-ws-service-secure.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd helloworld-ws-service-secure -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService - [java] 14-Jan-2008 14:22:07 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyS -ervice - [java] HelloWorld server started (press enter to shutdown) - -As this point the SCA service is exposed as a web service by a web server -started automatically by the SCA runtime. The webservice requires clients to -have security headers that carry userid tonken and password text. - -To stop the server just press enter. - -To exercise the service run up the helloworld-ws-reference-secure sample. Take a look at -the README in that sample and you will see you need the following commands - -cd helloworld-ws-reference-secure -ant run - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-reference-secure sample as Maven includes a simple ping test to make sure that the -service is available - -cd helloworld-ws-service-secure -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldServerTestCase -14-Jan-2008 14:23:20 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:23:20 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -1.dtd -14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -2.dtd -14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:23:20 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService -14-Jan-2008 14:23:21 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldWsPolicyService -14-Jan-2008 14:23:21 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.734 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-service-secure/build.xml b/java/sca/samples/helloworld-ws-service-secure/build.xml deleted file mode 100644 index 29bbae0173..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png b/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png deleted file mode 100644 index 6f7d9dd450..0000000000 Binary files a/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg b/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg deleted file mode 100644 index 53eb552923..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/helloworld-ws-service-secure.svg +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - HelloWorldWebService - - diff --git a/java/sca/samples/helloworld-ws-service-secure/pom.xml b/java/sca/samples/helloworld-ws-service-secure/pom.xml deleted file mode 100644 index b2a1245d79..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-helloworld-ws-service-secure - Apache Tuscany SCA HelloWorld Secure Web Service Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.ws.security - wss4j - 1.5.3 - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 2186c00e57..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java b/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index 3d43290380..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - public static void main(String[] args) { - - SCADomain scaDomain = SCADomain.newInstance("helloworldws.composite"); - - try { - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - System.out.println("HelloWorld server stopped"); - } - -} diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index a0081be22d..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} - diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java b/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java deleted file mode 100644 index ded02f09d6..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/java/helloworld/ServerPWCBHandler.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.ws.security.WSPasswordCallback; - -/** - * Sample userid passwd generation class - */ -public class ServerPWCBHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - System.out.println("*** Calling Server User/Passwd Handler...."); - WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; - System.out.println("User Id = " + pwcb.getIdentifer()); - System.out.println("Password = " + pwcb.getPassword()); - - if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN ) { - if ( pwcb.getIdentifer().equals("TuscanyWsUser") && - pwcb.getPassword().equals("TuscanyWsUserPasswd") ){ - return; - } else { - throw new UnsupportedCallbackException(pwcb, "Authentication Failed : UserId - Password mismatch"); - } - } else if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { - pwcb.setPassword("TuscanyWsUserPasswd"); - } - } - } - -} diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml b/java/sca/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml deleted file mode 100644 index 10fa7b8652..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/definitions.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - UsernameToken - helloworld.ServerPWCBHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TuscanyWsUser - TuscanyWsUser - helloworld.ServerPWCBHandler - - - - JKS - helloworldKeys.jks - TuscanyWsUserPasswd - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks b/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks deleted file mode 100644 index 0b4f2399f0..0000000000 Binary files a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldKeys.jks and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite b/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite deleted file mode 100644 index d1e18d7929..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/helloworldws.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 068229be6f..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java b/java/sca/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java deleted file mode 100644 index 4a14afcd9d..0000000000 --- a/java/sca/samples/helloworld-ws-service-secure/src/test/java/helloworld/HelloWorldServerTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldServerTestCase{ - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - scaDomain = SCADomain.newInstance("helloworldws.composite"); - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/helloworld-ws-service-webapp/README b/java/sca/samples/helloworld-ws-service-webapp/README deleted file mode 100644 index 66040004f8..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/README +++ /dev/null @@ -1 +0,0 @@ -http://localhost:8080/sample-helloworld-ws-service-webapp/SCA/HelloWorldService?wsdl diff --git a/java/sca/samples/helloworld-ws-service-webapp/build.xml b/java/sca/samples/helloworld-ws-service-webapp/build.xml deleted file mode 100644 index ff850203b3..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/build.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-webapp/pom.xml b/java/sca/samples/helloworld-ws-service-webapp/pom.xml deleted file mode 100644 index 63dd133c2c..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - - sample-helloworld-ws-service-webapp - Apache Tuscany SCA HelloWorld Web Service Sample Webapp - war - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-webapp - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - - stax - stax-api - 1.0.1 - provided - - - - - javax.servlet - servlet-api - 2.3 - provided - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index a75187f0d7..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 18f74b083f..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 0b95fbd14f..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite b/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite deleted file mode 100644 index 114608e4d8..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/META-INF/sca-deployables/helloworldws.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index c514922045..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-helloworld-ws-service-webapp - 2.0-SNAPSHOT - war - - - - - diff --git a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 3f3c92fa78..0000000000 --- a/java/sca/samples/helloworld-ws-service-webapp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - Apache Tuscany HelloWorld Web Service Sample - - - org.apache.tuscany.sca.host.webapp.TuscanyContextListener - - - - TuscanyServlet - org.apache.tuscany.sca.host.webapp.TuscanyServlet - - - - TuscanyServlet - /SCA/* - - - - /SCA/HelloWorldComponent/HelloWorldService?wsdl - - - diff --git a/java/sca/samples/helloworld-ws-service/README b/java/sca/samples/helloworld-ws-service/README deleted file mode 100644 index 72417d3160..0000000000 --- a/java/sca/samples/helloworld-ws-service/README +++ /dev/null @@ -1,140 +0,0 @@ -Holder Pattern Service Sample -====================================== -This sample demonstrates an SCA service that uses a web service binding. The -web service binding has been generated from a given WSDL file: - src/main/resources/wsdl/orderservice.wsdl -The generated binding has been placed in src/main/java/org/examle/orderservice -and was generated via the JDK tool wsimport and the command: - wsimport -d orderservice -keep orderservice.wsdl - -The interesting feature of this sample is that the generated service interface, -OrderService, contains a method with the signature: - public void reviewOrder( - @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) - javax.xml.ws.Holder orderData); -The orderData parameter is an input/output parameter that is provided by the caller, -updated by the service, and returned to the caller. The business object is updated -in place, a common pattern in web services, and not returned as a response. Tuscany -can handle limited instances of this pattern. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-holder-ws-service.jar org.example.orderservice.OrderServiceTestCase - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-holder-ws-service.jar org.example.orderservice.OrderServiceTestCase - -Sample Overview ---------------- -The sample provides a single component that is wired to a service with a -web service binding. - -holder-ws-service/ - src/ - main/ - java/ - org/ - example/ - orderservice - *.java - Web service binding generated from - HelloWorldServiceComponent - resources/ - wsdl/ - orderservice.wsdl - the service description that describes - the exposed service - orderws.composite - the SCA assembly that uses this service - test/ - java/ - helloworld/ - org/ - example/ - orderservice/ - OrderServiceTestCase.java - JUnit test case - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd holder-ws-service -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 14-Jan-2008 14:18:47 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8085/HelloWorldService - [java] HelloWorld server started (press enter to shutdown) - -As this point the SCA service is exposed as a web service by a web server -started automatically by the SCA runtime. To stop the server just press -enter. - -To exercise the service run up the helloworld-ws-reference sample. Take a look at -the README in that sample and you will see you need the following commands - -cd holder-ws-reference -ant run - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. When using Maven you don't need to run the helloworld- -ws-reference sample as Maven includes a simple ping test to make sure that the -service is available - -cd holder-ws-service -mvn - -You should see the following output from the test phase. -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running org.example.orderservice.OrderServiceTestCase -Jan 21, 2009 9:31:11 AM org.apache.tuscany.sca.node.impl.NodeImpl -INFO: Creating node: META-INF/sca-deployables/orderws.composite -Jan 21, 2009 9:31:13 AM org.apache.tuscany.sca.node.impl.NodeImpl configureNode -INFO: Loading contribution: file:/E:/t/branches/sca-java-1.x/samples/holder-ws-webservice/target/classes/ -Jan 21, 2009 9:31:14 AM org.apache.tuscany.sca.node.impl.NodeImpl configureNode -INFO: Loading composite: file:/E:/t/branches/sca-java-1.x/samples/holder-ws-webservice/target/classes/META-INF/sca-deployables/orderws.composite -Jan 21, 2009 9:31:14 AM org.apache.tuscany.sca.node.impl.NodeImpl start -INFO: Starting node: META-INF/sca-deployables/orderws.composite -- No JMS connection factories are defined.Will not listen for any JMS messages -Jan 21, 2009 9:31:15 AM org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.14 -Jan 21, 2009 9:31:15 AM org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -Jan 21, 2009 9:31:15 AM org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -Jan 21, 2009 9:31:15 AM org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -- No JMS connection factories are defined.Will not listen for any JMS messages -Jan 21, 2009 9:31:15 AM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping -INFO: Added Servlet mapping: http://T602010:8085/OrderService ->>> Order submitted=Order[customerId=cust1234,orderId=0,total=50.0,status=Created] ->>> OrderService.reviewOrder return=Order[customerId=cust1234,orderId=0,total=50.0,status=Approved] ->>> Order returned=Order[customerId=cust1234,orderId=0,total=50.0,status=Approved] -Jan 21, 2009 9:31:16 AM org.apache.tuscany.sca.node.impl.NodeImpl stop -INFO: Stopping node: META-INF/sca-deployables/orderws.composite -Jan 21, 2009 9:31:17 AM org.apache.tuscany.sca.http.tomcat.TomcatServer removeServletMapping -INFO: Removed Servlet mapping: http://T602010:8085/OrderService -Jan 21, 2009 9:31:17 AM org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 - -Note the console output with ">>>" prefix. This shows that an order was submitted in -the "Created" state, handled by the OrderService reviewOrder method, and returned in -the "Approved" state. This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/helloworld-ws-service/build.xml b/java/sca/samples/helloworld-ws-service/build.xml deleted file mode 100644 index 7a59628c7b..0000000000 --- a/java/sca/samples/helloworld-ws-service/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png b/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png deleted file mode 100644 index eab29d0bcd..0000000000 Binary files a/java/sca/samples/helloworld-ws-service/helloworld-ws-service.png and /dev/null differ diff --git a/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg b/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg deleted file mode 100644 index 61cd93ead9..0000000000 --- a/java/sca/samples/helloworld-ws-service/helloworld-ws-service.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - helloworldws - - HelloWorldServiceComponent - - HelloWorldWebService - - diff --git a/java/sca/samples/helloworld-ws-service/pom.xml b/java/sca/samples/helloworld-ws-service/pom.xml deleted file mode 100644 index a895191917..0000000000 --- a/java/sca/samples/helloworld-ws-service/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.5-SNAPSHOT - ../../pom.xml - - sample-holder-ws-service - Apache Tuscany SCA Holder Input/Output Web Service Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.5-SNAPSHOT - compile - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 1.5-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 1.5-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java b/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index a75187f0d7..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the HelloWorld service. - */ -@Service(HelloWorldService.class) -public class HelloWorldImpl implements HelloWorldService { - - public String getGreetings(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java b/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java deleted file mode 100644 index c37bfcda65..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldServer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the helloworld Web service endpoint. - */ -public class HelloWorldServer { - - public static void main(String[] args) { - - SCADomain scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); - - try { - System.out.println("HelloWorld server started (press enter to shutdown)"); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - System.out.println("HelloWorld server stopped"); - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java b/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java deleted file mode 100644 index 513c2e3129..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/helloworld/HelloWorldService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the HelloWorld greetings service. - */ -@Remotable -public interface HelloWorldService { - - public String getGreetings(String name); -} - diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java deleted file mode 100644 index e472b2bada..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ObjectFactory.java +++ /dev/null @@ -1,56 +0,0 @@ - -package org.example.orderservice; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the org.example.orderservice package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.example.orderservice - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link ReviewOrderResponse } - * - */ - public ReviewOrderResponse createReviewOrderResponse() { - return new ReviewOrderResponse(); - } - - /** - * Create an instance of {@link Order } - * - */ - public Order createOrder() { - return new Order(); - } - - /** - * Create an instance of {@link ReviewOrder } - * - */ - public ReviewOrder createReviewOrder() { - return new ReviewOrder(); - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java deleted file mode 100644 index 7508887a7d..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Order.java +++ /dev/null @@ -1,129 +0,0 @@ - -package org.example.orderservice; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for order complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="order">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="customerId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="status" type="{http://www.example.org/OrderService/}status" minOccurs="0"/>
- *         <element name="total" type="{http://www.w3.org/2001/XMLSchema}double"/>
- *         <element name="orderId" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "order", propOrder = { - "customerId", - "status", - "total", - "orderId" -}) -public class Order { - - protected String customerId; - protected Status status; - protected double total; - protected int orderId; - - /** - * Gets the value of the customerId property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getCustomerId() { - return customerId; - } - - /** - * Sets the value of the customerId property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setCustomerId(String value) { - this.customerId = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link Status } - * - */ - public Status getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link Status } - * - */ - public void setStatus(Status value) { - this.status = value; - } - - /** - * Gets the value of the total property. - * - */ - public double getTotal() { - return total; - } - - /** - * Sets the value of the total property. - * - */ - public void setTotal(double value) { - this.total = value; - } - - /** - * Gets the value of the orderId property. - * - */ - public int getOrderId() { - return orderId; - } - - /** - * Sets the value of the orderId property. - * - */ - public void setOrderId(int value) { - this.orderId = value; - } - - // Added manually from wsimport generated class to improve debugging. - public String toString() { - return "Order[customerId=" + customerId + ",orderId=" + orderId + ",total=" + total + ",status=" + status.value() + "]"; - } -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java deleted file mode 100644 index a11d733cc9..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService.java +++ /dev/null @@ -1,37 +0,0 @@ - -package org.example.orderservice; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Holder; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.1.1 in JDK 6 - * Generated source version: 2.1 - * - */ -@WebService(name = "OrderService", targetNamespace = "http://www.example.org/OrderService/") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface OrderService { - - - /** - * - * @param myData - */ - @WebMethod(action = "http://www.example.org/OrderService/reviewOrder") - @RequestWrapper(localName = "reviewOrder", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrder") - @ResponseWrapper(localName = "reviewOrderResponse", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrderResponse") - public void reviewOrder( - @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) - Holder myData); - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java deleted file mode 100644 index 0e084bf459..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderServiceImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.example.orderservice; - -// import org.oasisopen.sca.annotation.Service; -import java.util.Random; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.xml.ws.Holder; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - -/** - * This class implements the OrderService service. - */ -// @Service(OrderService.class) -public class OrderServiceImpl implements OrderService { - - /** This dummy implementation approves or rejects orders: - * < 100 - always approved. - * 100-1100 - randomly approved. Probability = (1100 - amount)/10 - * >1100 - always rejected. - */ - // public Order reviewOrder(Order order) { - @WebMethod(action = "http://www.example.org/OrderService/reviewOrder") - @RequestWrapper(localName = "reviewOrder", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrder") - @ResponseWrapper(localName = "reviewOrderResponse", targetNamespace = "http://www.example.org/OrderService/", className = "org.example.orderservice.ReviewOrderResponse") - public void reviewOrder( - @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT) - Holder myData) { - Order order = myData.value; - double total = order.getTotal(); - if ( total < 100.0 ) { - order.setStatus( Status.APPROVED ); - } else if ( total > 1100.0 ) { - order.setStatus( Status.REJECTED ); - } else { - int probability = (int) ((-100.0 + total) / 10.0); - Random approver = new Random(); - if ( approver.nextInt( 100 ) < probability ) - order.setStatus( Status.APPROVED ); - else - order.setStatus( Status.REJECTED ); - } - System.out.println( ">>> OrderService.reviewOrder return=" + order ); - // return order; - } -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java deleted file mode 100644 index 9c8ff711ea..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/OrderService_Service.java +++ /dev/null @@ -1,66 +0,0 @@ - -package org.example.orderservice; - -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.1.1 in JDK 6 - * Generated source version: 2.1 - * - */ -@WebServiceClient(name = "OrderService", targetNamespace = "http://www.example.org/OrderService/", wsdlLocation = "META-INF/sca-deployables/orderservice.wsdl") -public class OrderService_Service - extends Service -{ - - private final static URL ORDERSERVICE_WSDL_LOCATION; - - static { - URL url = null; - try { - url = new URL("META-INF/sca-deployables/orderservice.wsdl"); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - ORDERSERVICE_WSDL_LOCATION = url; - } - - public OrderService_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public OrderService_Service() { - super(ORDERSERVICE_WSDL_LOCATION, new QName("http://www.example.org/OrderService/", "OrderService")); - } - - /** - * - * @return - * returns OrderService - */ - @WebEndpoint(name = "OrderServiceSOAP") - public OrderService getOrderServiceSOAP() { - return (OrderService)super.getPort(new QName("http://www.example.org/OrderService/", "OrderServiceSOAP"), OrderService.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns OrderService - */ - @WebEndpoint(name = "OrderServiceSOAP") - public OrderService getOrderServiceSOAP(WebServiceFeature... features) { - return (OrderService)super.getPort(new QName("http://www.example.org/OrderService/", "OrderServiceSOAP"), OrderService.class, features); - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java deleted file mode 100644 index 9e7192a0d0..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrder.java +++ /dev/null @@ -1,64 +0,0 @@ - -package org.example.orderservice; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="myData" type="{http://www.example.org/OrderService/}order"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "myData" -}) -@XmlRootElement(name = "reviewOrder") -public class ReviewOrder { - - @XmlElement(required = true) - protected Order myData; - - /** - * Gets the value of the myData property. - * - * @return - * possible object is - * {@link Order } - * - */ - public Order getMyData() { - return myData; - } - - /** - * Sets the value of the myData property. - * - * @param value - * allowed object is - * {@link Order } - * - */ - public void setMyData(Order value) { - this.myData = value; - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java deleted file mode 100644 index 90dbc3f25e..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/ReviewOrderResponse.java +++ /dev/null @@ -1,64 +0,0 @@ - -package org.example.orderservice; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="myData" type="{http://www.example.org/OrderService/}order"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "myData" -}) -@XmlRootElement(name = "reviewOrderResponse") -public class ReviewOrderResponse { - - @XmlElement(required = true) - protected Order myData; - - /** - * Gets the value of the myData property. - * - * @return - * possible object is - * {@link Order } - * - */ - public Order getMyData() { - return myData; - } - - /** - * Sets the value of the myData property. - * - * @param value - * allowed object is - * {@link Order } - * - */ - public void setMyData(Order value) { - this.myData = value; - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java deleted file mode 100644 index 73a1b5c45e..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/Status.java +++ /dev/null @@ -1,57 +0,0 @@ - -package org.example.orderservice; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for status. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="status">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="Created"/>
- *     <enumeration value="Submitted"/>
- *     <enumeration value="Approved"/>
- *     <enumeration value="Rejected"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "status") -@XmlEnum -public enum Status { - - @XmlEnumValue("Created") - CREATED("Created"), - @XmlEnumValue("Submitted") - SUBMITTED("Submitted"), - @XmlEnumValue("Approved") - APPROVED("Approved"), - @XmlEnumValue("Rejected") - REJECTED("Rejected"); - private final String value; - - Status(String v) { - value = v; - } - - public String value() { - return value; - } - - public static Status fromValue(String v) { - for (Status c: Status.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} diff --git a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java b/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java deleted file mode 100644 index 64c056b7fb..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/java/org/example/orderservice/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.example.org/OrderService/") -package org.example.orderservice; diff --git a/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite b/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite deleted file mode 100644 index d767625ae7..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/helloworldws.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite b/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite deleted file mode 100644 index d34891d1af..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/resources/META-INF/sca-deployables/orderws.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl b/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl deleted file mode 100644 index 454763410c..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/helloworld.wsdl +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl b/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl deleted file mode 100644 index fd8ef74403..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/main/resources/wsdl/orderservice.wsdl +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java b/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java deleted file mode 100644 index 189332be91..0000000000 --- a/java/sca/samples/helloworld-ws-service/src/test/java/helloworld/HelloWorldServerTestCase.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the helloworld server is available - */ -public class HelloWorldServerTestCase{ - - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - scaDomain = SCADomain.newInstance("META-INF/sca-deployables/helloworldws.composite"); - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @Test - public void testServiceCall() throws IOException { - HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent/HelloWorldService"); - assertNotNull(helloWorldService); - - assertEquals("Hello Smith", helloWorldService.getGreetings("Smith")); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } - -} diff --git a/java/sca/samples/host-webapp-calculator/README b/java/sca/samples/host-webapp-calculator/README deleted file mode 100644 index 690152ff65..0000000000 --- a/java/sca/samples/host-webapp-calculator/README +++ /dev/null @@ -1,108 +0,0 @@ -Calculator Sample Exposing Web Services In A WebApp -=================================================== -This sample uses the same code as the calculator sample, it deploys the -sample wrapped in a web app and exposes the AddService as a web service. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -As this sample provides a web app there is a manual step where the WAR file -that contains the sample is copied to your web app container. If you just want -to give this sample a go deploy the WAR file (target/sample-calculator-ws-webapp.war) -to you web application server. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-webapp - -The sample is configured to use a service on port 8080. If your servlet container -is using a port other than 8080 then you will need to edit the Calculator.composite -and change the uri attribute of the used by the CalculatorServiceComponent -to use the correct port. - -Sample Overview ---------------- -The sample provides a single calculator service with a default SCA (java) -binding. The CalculatorClient exercises this interface by calling add, -subtract, multiply and divide operations. This results in messages passing to -the appropriate components in the composite. - -calculator-webapp/ - src/ - main/ - java/ - calculator/ - AddService.java - As calculator sample - AddServiceImpl.java - CalculatorClient.java - As calculator sample - CalculatorService.java - As calculator sample - CalculatorServiceImpl.java - DivideService.java - As calculator sample - DivideServiceImpl.java - MultiplyService.java - As calculator sample - MultiplyServiceImpl.java - SubtractService.java - As calculator sample - SubtractServiceImpl.java - resources/ - Calculator.composite - As calculator sample except that the - connection between the CalculatorService - and the AddService is web services - webapp - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - WEB-INF/ - web.xml - defines the listener that starts up the - Tuscany SCA runtime and maps service - calls to the TuscanyServlet - calc.jsp - the web application that makes use of the - SCA application - - calculator.png - a pictorial representation of the sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - README - this file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as -follows - -cd calculator-ws-webapp -ant package - -This should result in a war file (sample-calculator-ws-webapp.war) in the target -directory. Copy this war file to your web app deployment directory in you -web app container. - -The process for getting the web app running will depend on which web app container -you are using. For example, if you are using Tomcat then it is simply a matter -of copying the WAR file to the webapps directory. - -Once the web app is deployed use your browser to visit the following URL; - -http://localhost:8080/sample-calculator-ws-webapp - -The port and hostname will of course vary depending on your local installation. - -You should see the following output. - -Expression Result -2 + 3 5.0 -3 - 2 1.0 -3 * 2 6.0 -3 / 2 1.5 - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd calculator-ws-webapp -mvn - -Again this should result in a war file (sample-calculator-ws-webapp.war) in the target -directory. Follow the steps described in the previous section for running the web -app and for the expected results. - - diff --git a/java/sca/samples/host-webapp-calculator/build.xml b/java/sca/samples/host-webapp-calculator/build.xml deleted file mode 100644 index bef3f946e9..0000000000 --- a/java/sca/samples/host-webapp-calculator/build.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/host-webapp-calculator/calculator-web.png b/java/sca/samples/host-webapp-calculator/calculator-web.png deleted file mode 100644 index f482b8d1c8..0000000000 Binary files a/java/sca/samples/host-webapp-calculator/calculator-web.png and /dev/null differ diff --git a/java/sca/samples/host-webapp-calculator/calculator-web.svg b/java/sca/samples/host-webapp-calculator/calculator-web.svg deleted file mode 100644 index 1b7015b156..0000000000 --- a/java/sca/samples/host-webapp-calculator/calculator-web.svg +++ /dev/null @@ -1,455 +0,0 @@ - - - - - - - - - - - - - - image/svg+xml - - - - - - - - Calculator - - CalculatorServiceComponent - - - CalculatorService - AddServiceComponent - - SubtractServiceComponent - - MultiplyServiceComponent - - DivideServiceComponent - addService - subtractService - multiplyService - divideService - - - - - - calc.jsp - - AppServer SOAP local local local - - - - diff --git a/java/sca/samples/host-webapp-calculator/pom.xml b/java/sca/samples/host-webapp-calculator/pom.xml deleted file mode 100644 index 2e1c719e7d..0000000000 --- a/java/sca/samples/host-webapp-calculator/pom.xml +++ /dev/null @@ -1,162 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-host-webapp-calculator - war - Apache Tuscany SCA Host Webapp Calculator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-distribution-api - pom - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-distribution-core - pom - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-distribution-webservice - pom - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-distribution-webapp - pom - 2.0-SNAPSHOT - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.1 - - - - ant - ant-trax - 1.6.5 - - - - - - test-ant-scripts - package - - run - - - - - - - - - - - - - - diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddService.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddService.java deleted file mode 100644 index 19e43317eb..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The interface for the add service - */ -@Remotable -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index e96b0faa96..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/AddServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Service; - -/** - * An implementation of the Add service - */ -@Service(AddService.class) -public class AddServiceImpl implements AddService { - - public double add(double n1, double n2) { - System.err.println("Adding " + n1 + " to " + n2); - return n1 + n2; - } - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 39f55ca31f..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -import org.oasisopen.sca.annotation.Reference; - -/** - * An implementation of the Calculator service. - */ -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java deleted file mode 100644 index 497dafd4fd..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the divide service - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index f7ac0b7287..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/DivideServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Divide service. - */ -public class DivideServiceImpl implements DivideService { - - public double divide(double n1, double n2) { - return n1 / n2; - } - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the multiply service - */ -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index b7dca792b2..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/MultiplyServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the Multiply service. - */ -public class MultiplyServiceImpl implements MultiplyService { - - public double multiply(double n1, double n2) { - return n1 * n2; - } - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java deleted file mode 100644 index 376b3e5bb9..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * The interface for the subtract service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java b/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 77b128ab8d..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/java/calculator/SubtractServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package calculator; - -/** - * An implementation of the subtract service. - */ -public class SubtractServiceImpl implements SubtractService { - - public double subtract(double n1, double n2) { - return n1 - n2; - } - -} diff --git a/java/sca/samples/host-webapp-calculator/src/main/resources/Calculator.composite b/java/sca/samples/host-webapp-calculator/src/main/resources/Calculator.composite deleted file mode 100644 index 6a00b85f62..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/resources/Calculator.composite +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml deleted file mode 100644 index 8e3132eaa1..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/webapp/META-INF/sca-contribution.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml deleted file mode 100644 index 59bbb0de83..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/geronimo-web.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.apache.tuscany.sca - sample-calculator-ws-webapp - 2.0-SNAPSHOT - war - - - - - - diff --git a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite b/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite deleted file mode 100644 index e839694501..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.composite +++ /dev/null @@ -1,24 +0,0 @@ - - - - - diff --git a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 701ba48203..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Apache Tuscany Calculator Web Service Sample - - - tuscany - org.apache.tuscany.sca.host.webapp.TuscanyServletFilter - - - - tuscany - /* - - - - calc.jsp - - - diff --git a/java/sca/samples/host-webapp-calculator/src/main/webapp/calc.jsp b/java/sca/samples/host-webapp-calculator/src/main/webapp/calc.jsp deleted file mode 100644 index 4c4366747d..0000000000 --- a/java/sca/samples/host-webapp-calculator/src/main/webapp/calc.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<%-- - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. ---%> - -<%@ page import="org.apache.tuscany.sca.host.embedded.SCADomain"%> -<%@ page import="calculator.CalculatorService" %> - -<%@ page contentType="text/html;charset=UTF-8" language="java" %> -<% - SCADomain scaDomain = (SCADomain) application.getAttribute("org.apache.tuscany.sca.SCADomain"); - CalculatorService calculatorService = (CalculatorService)scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent"); -%> - -Calculator sample - - - - - - - - - - - - - - - - - - -
ExpressionResult
2 + 3<%= calculatorService.add(2, 3) %>
3 - 2<%= calculatorService.subtract(3, 2) %>
3 * 2<%= calculatorService.multiply(3, 2) %>
3 / 2<%= calculatorService.divide(3, 2) %>
- - diff --git a/java/sca/samples/implementation-composite/README b/java/sca/samples/implementation-composite/README deleted file mode 100644 index 27de00e8ef..0000000000 --- a/java/sca/samples/implementation-composite/README +++ /dev/null @@ -1,116 +0,0 @@ -Composite Implementation Sample -=============================== - -This sample shows how composites can be used to implement components. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-composite.jar composite.CompositeClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-composite.jar composite.CompositeClient - - -Sample Overview ---------------- - -The sample is comprised of three composites. Take a look at the composite file -or the .svg/.png file which shows the composite file in pictorial form. The -OuterComposite defines three components two of which are implemented using -composites. The SourceComponent calls each TargetComponent in turn. There is a -callback which returns from each TargetComponent to the SourceComponent. - -implementation-composite/ - src/ - main/ - java/ - composite/ - Source.java - interface for the source component - SourceImpl.java - implementation for the source component - SourceCallback.java - source component callback interface - Target.java - interface for the target component - TargetImpl.java - implementation for the target component - CompositeClient.java - starts the SCA Runtime and - deploys the OuterComposite.composite. - This in turn pulls in the two inner - composites - resources/ - META-INF/ - sca-contribution.xml - specifies the composite to be deployed - OuterComposite.composite - the top level SCA assembly for this sample - InnerComposite.composite - included by OuterComposite.composite - InnerComposite2.composite - included by OuterComposite.composite - test/ - java/ - composite/ - CompositeTestCase.java - JUnit test case - implementation-composite.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd implementation-composite -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Main thread Thread[main,5,main] - [java] Source: Client.main -> Source.clientMethod - [java] Source: Client.main => Source.clientMethod2 - [java] Sleeping ... - [java] Target: Client.main -> Source.clientMethod - [java] Work thread Thread[pool-1-thread-1,5,main] - [java] Result: Client.main -> Source.clientMethod -> Target.someMethod - [java] Target: Client.main => Source.clientMethod2 - [java] Work thread Thread[pool-1-thread-2,5,main] - [java] Result: Client.main => Source.clientMethod2 -> Target.someMethod - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd implementation-composite -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running composite.CompositeTestCase -Main thread Thread[main,5,main] -Source: Client.main -> Source.clientMethod -Source: Client.main => Source.clientMethod2 -Sleeping ... -Target: Client.main => Source.clientMethod2 -Work thread Thread[pool-1-thread-2,5,main] -Result: Client.main => Source.clientMethod2 -> Target.someMethod -Target: Client.main -> Source.clientMethod -Work thread Thread[pool-1-thread-1,5,main] -Result: Client.main -> Source.clientMethod -> Target.someMethod -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.973 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/implementation-composite/build.xml b/java/sca/samples/implementation-composite/build.xml deleted file mode 100644 index 7aa31aab8b..0000000000 --- a/java/sca/samples/implementation-composite/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-composite/implementation-composite.png b/java/sca/samples/implementation-composite/implementation-composite.png deleted file mode 100644 index 4c6d71bc03..0000000000 Binary files a/java/sca/samples/implementation-composite/implementation-composite.png and /dev/null differ diff --git a/java/sca/samples/implementation-composite/implementation-composite.svg b/java/sca/samples/implementation-composite/implementation-composite.svg deleted file mode 100644 index 0e60354aab..0000000000 --- a/java/sca/samples/implementation-composite/implementation-composite.svg +++ /dev/null @@ -1,658 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - OuterComposite - InnerComposite - - OuterComposite.composite - InnerComposite.composite - InnerComposite2.composite - SourceComponent - - TargetComponentRef TargetComponentRef2 - - TargetComponent - - TargetComponent2 - - - InnerSourceService - InnerSourceComponent - - - - - - TargetComponentRef TargetComponentRef2 - - promote promote - InnerTargetService - InnerTargetComponent - - TargetImpl Target - - Target - - SourceImpl - Source - SourceCallback - - - - - Target Source - InnerComposite2 promote promote - diff --git a/java/sca/samples/implementation-composite/pom.xml b/java/sca/samples/implementation-composite/pom.xml deleted file mode 100644 index 91f8af09f3..0000000000 --- a/java/sca/samples/implementation-composite/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-implementation-composite - Apache Tuscany SCA Composite Sample - A sample showing local wiring of a component implemented by a nested composite - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/java/sca/samples/implementation-composite/src/main/java/composite/CompositeClient.java deleted file mode 100644 index bf743e1797..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/CompositeClient.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package composite; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Simple client program that invokes the components that we wired together. - */ -public class CompositeClient { - - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance(); - - Source source = scaDomain.getService(Source.class, "SourceComponent"); - - System.out.println("Main thread " + Thread.currentThread()); - source.clientMethod("Client.main"); - System.out.println("Sleeping ..."); - Thread.sleep(1000); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/Source.java b/java/sca/samples/implementation-composite/src/main/java/composite/Source.java deleted file mode 100644 index d0efcc1df1..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/Source.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -public interface Source { - - void clientMethod(String arg); -} diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/java/sca/samples/implementation-composite/src/main/java/composite/SourceCallback.java deleted file mode 100644 index baa95a8e39..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/SourceCallback.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -public interface SourceCallback { - - void receiveResult(String result); -} diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/java/sca/samples/implementation-composite/src/main/java/composite/SourceImpl.java deleted file mode 100644 index 8e2b347604..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/SourceImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - - -@Service(Source.class) -@Scope("COMPOSITE") -public class SourceImpl implements Source, SourceCallback { - - private Target targetReference; - private Target targetReference2; - - @Reference - public void setTargetReference(Target target) { - this.targetReference = target; - } - - @Reference - public void setTargetReference2(Target target) { - this.targetReference2 = target; - } - - public void clientMethod(String arg) { - System.out.println("Source: " + arg + " -> Source.clientMethod"); - targetReference.someMethod(arg + " -> Source.clientMethod"); - - System.out.println("Source: " + arg + " => Source.clientMethod2"); - targetReference2.someMethod(arg + " => Source.clientMethod2"); - } - - public void receiveResult(String result) { - System.out.println("Work thread " + Thread.currentThread()); - System.out.println("Result: " + result); - } -} diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/Target.java b/java/sca/samples/implementation-composite/src/main/java/composite/Target.java deleted file mode 100644 index 703e72fc10..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/Target.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; - - -@Callback(SourceCallback.class) -public interface Target { - - @OneWay - void someMethod(String arg); -} diff --git a/java/sca/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/java/sca/samples/implementation-composite/src/main/java/composite/TargetImpl.java deleted file mode 100644 index cd9a9746fa..0000000000 --- a/java/sca/samples/implementation-composite/src/main/java/composite/TargetImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - - -@Service(Target.class) -@Scope("COMPOSITE") -public class TargetImpl implements Target { - - private SourceCallback sourceCallback; - - @Callback - public void setSourceCallback(SourceCallback sourceCallback) { - this.sourceCallback = sourceCallback; - } - - public void someMethod(String arg) { - System.out.println("Target: " + arg); - sourceCallback.receiveResult(arg + " -> Target.someMethod"); - } -} diff --git a/java/sca/samples/implementation-composite/src/main/resources/InnerComposite.composite b/java/sca/samples/implementation-composite/src/main/resources/InnerComposite.composite deleted file mode 100644 index 3376ac8ff5..0000000000 --- a/java/sca/samples/implementation-composite/src/main/resources/InnerComposite.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/java/sca/samples/implementation-composite/src/main/resources/InnerComposite2.composite deleted file mode 100644 index c9eff4fa9d..0000000000 --- a/java/sca/samples/implementation-composite/src/main/resources/InnerComposite2.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index e675fd3624..0000000000 --- a/java/sca/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/java/sca/samples/implementation-composite/src/main/resources/OuterComposite.composite b/java/sca/samples/implementation-composite/src/main/resources/OuterComposite.composite deleted file mode 100644 index cb1c1e13d4..0000000000 --- a/java/sca/samples/implementation-composite/src/main/resources/OuterComposite.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/java/sca/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java deleted file mode 100644 index 9e9a4b44a4..0000000000 --- a/java/sca/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package composite; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class CompositeTestCase extends TestCase { - - private SCADomain scaDomain; - private Source source; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance(); - source = scaDomain.getService(Source.class, "SourceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - try { - System.out.println("Main thread " + Thread.currentThread()); - source.clientMethod("Client.main"); - System.out.println("Sleeping ..."); - Thread.sleep(1000); - } catch (Throwable t) { - t.printStackTrace(); - } - } -} diff --git a/java/sca/samples/implementation-crud-extension/README b/java/sca/samples/implementation-crud-extension/README deleted file mode 100644 index 5e8190648f..0000000000 --- a/java/sca/samples/implementation-crud-extension/README +++ /dev/null @@ -1,83 +0,0 @@ -Implementation CRUD Sample -========================== -This sample demonstrates how new implementation types are constructed for -Apache Tuscany SCA. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you want to try out the CRUD implementation type that this sample provides -please see the implementation-crud sample that provides the necessary client -code to bring up an application that uses this implementation extension. - -Sample Overview ---------------- -This sample contains a CRUD implementation type as an example of how to create -new implementation types. Components using this implementation type always -expose the same Create, Retrieve, Update and Delete interface. This sample -uses a singleton ResourceManager to perform the CRUD operations but of course -a real component would provide a real implementation. - -implementation-crud-extension/ - src/ - main/ - java/ - crud/ - implementation model interfaces - backend/ - fake component implementation - impl/ - implementations of the model interfaces - provider/ - runtime implementation - resources/ - META-INF/ - services/ - declares the extension - test/ - java/ - crud/ - CRUDTestCase.java - JUnit test case - resources/ - crud.composite - the SCA assembly used during unit testing - - build.xml - the Ant build file - pom.xml - the Maven build file - -Building The Sample Extension Using Ant ------------------------------------------ -With the binary distribution the sample extension can be built using Ant as -follows - -cd implementation-crud-extension -ant compile - -See the implementation-crud sample to run a sample that uses this -implementation extension. - -Building The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built -using Maven as follows. - -cd implementation-crud-extension -mvn - -Maven will also test that the sample extension built properly. You should see -the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running crud.CRUDTestCase -Starting CRUDServiceComponent -create(ABC) in tmp -retrieve(0) -update(0) -retrieve(0) -delete(0) -retrieve(0) -Stopping CRUDServiceComponent -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/implementation-crud-extension/build.xml b/java/sca/samples/implementation-crud-extension/build.xml deleted file mode 100644 index 88d308e6fc..0000000000 --- a/java/sca/samples/implementation-crud-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-crud-extension/pom.xml b/java/sca/samples/implementation-crud-extension/pom.xml deleted file mode 100644 index 6e044bd68e..0000000000 --- a/java/sca/samples/implementation-crud-extension/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-implementation-crud-extension - Apache Tuscany SCA CRUD Implementation Extension Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-assembly - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUD.java deleted file mode 100644 index b23d85887b..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUD.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package crud; - -/** - * The service interface of the single CRUD service provided by CRUD components. - */ -public interface CRUD { - - /** - * Create a new resource. - * @param resource - * @return - */ - String create(Object resource); - - /** - * Retrieve a resource. - * @param id - * @return - */ - Object retrieve(String id); - - /** - * Update a resource. - * @param id - * @param resource - * @return - */ - Object update(String id, Object resource); - - /** - * Delete a resource. - * @param id - */ - void delete(String id); - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java deleted file mode 100644 index 49be844f93..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package crud; - -import org.apache.tuscany.sca.assembly.Implementation; - -/** - * The model representing a sample CRUD implementation in an SCA assembly model. - * - * The sample CRUD implementation is not a full blown implementation, it only - * supports a subset of what a component implementation can support: - * - a single fixed service (as opposed to a list of services typed by different interfaces - * - a directory attribute used to specify where a CRUD component is going to persist - * resources - * - no references or properties - * - no policy intents or policy sets - */ -public interface CRUDImplementation extends Implementation { - - /** - * Returns the directory used by CRUD implementations to persist resources. - * - * @return the directory used to persist resources - */ - public String getDirectory(); - - /** - * Sets the directory used by CRUD implementations to persist resources. - * - * @param directory the directory used to persist resources - */ - public void setDirectory(String directory); - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java deleted file mode 100644 index fa83c63c1b..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud; - -import crud.CRUDImplementation; - - -/** - * A factory for the sample CRUD implementation model. - */ -public interface CRUDImplementationFactory { - - /** - * Creates a new CRUD implementation. - * - * @return - */ - CRUDImplementation createCRUDImplementation(); - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java deleted file mode 100644 index cc0795a735..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud.backend; - -import java.util.HashMap; -import java.util.Map; - -/** - * A fake resource manager implementation used as a backend by the sample - * CRUD component implementation. - */ -public class ResourceManager { - private static int counter; - private static final Map store = new HashMap(); - private String directory; - - /** - * Constructs a new resource manager. - * - * @param directory the directory where to persist resources - */ - public ResourceManager(String directory) { - super(); - this.directory = directory; - } - - /** - * Creates a new resource. - * - * @param resource - * @return - */ - public String createResource(Object resource) { - System.out.println("create(" + resource + ") in " + directory); - String key = String.valueOf(counter++); - store.put(key, resource); - return key; - } - - /** - * Deletes a resource. - * - * @param id - */ - public void deleteResource(String id) { - System.out.println("delete(" + id + ")"); - store.remove(id); - } - - /** - * Retrieves a resource. - * - * @param id - * @return - */ - public Object retrieveResource(String id) { - System.out.println("retrieve(" + id + ")"); - return store.get(id); - } - - /** - * Updates a resource. - * - * @param id - * @param resource - * @return - */ - public Object updateResource(String id, Object resource) { - System.out.println("update(" + id + ")"); - return store.put(id, resource); - } - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java deleted file mode 100644 index 2f1e5fcba8..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud.impl; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - -import crud.CRUDImplementation; -import crud.CRUDImplementationFactory; - - -/** - * A factory for the CRUD implementation model. - */ -public class CRUDImplementationFactoryImpl implements CRUDImplementationFactory { - - private AssemblyFactory assemblyFactory; - private JavaInterfaceFactory javaFactory; - - public CRUDImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) { - this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - } - - public CRUDImplementation createCRUDImplementation() { - return new CRUDImplementationImpl(assemblyFactory, javaFactory); - } - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java deleted file mode 100644 index 383a035e69..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package crud.impl; - -import java.util.Collections; -import java.util.List; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; - -import crud.CRUD; -import crud.CRUDImplementation; - - -/** - * The model representing a sample CRUD implementation in an SCA assembly model. - */ -class CRUDImplementationImpl implements CRUDImplementation { - - private Service crudService; - private String directory; - - /** - * Constructs a new CRUD implementation. - */ - CRUDImplementationImpl(AssemblyFactory assemblyFactory, - JavaInterfaceFactory javaFactory) { - - // CRUD implementation always provide a single service exposing - // the CRUD interface, and have no references and properties - crudService = assemblyFactory.createService(); - crudService.setName("CRUD"); - JavaInterface javaInterface; - try { - javaInterface = javaFactory.createJavaInterface(CRUD.class); - } catch (InvalidInterfaceException e) { - throw new IllegalArgumentException(e); - } - JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); - interfaceContract.setInterface(javaInterface); - crudService.setInterfaceContract(interfaceContract); - } - - public String getDirectory() { - return directory; - } - - public void setDirectory(String directory) { - this.directory = directory; - } - - public ConstrainingType getConstrainingType() { - // The sample CRUD implementation does not support constrainingTypes - return null; - } - - public List getProperties() { - // The sample CRUD implementation does not support properties - return Collections.emptyList(); - } - - public List getServices() { - // The sample CRUD implementation provides a single fixed CRUD service - return Collections.singletonList(crudService); - } - - public List getReferences() { - // The sample CRUD implementation does not support properties - return Collections.emptyList(); - } - - public String getURI() { - // The sample CRUD implementation does not have a URI - return null; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - // The sample CRUD implementation does not support constrainingTypes - } - - public void setURI(String uri) { - // The sample CRUD implementation does not have a URI - } - - public boolean isUnresolved() { - // The sample CRUD implementation is always resolved - return false; - } - - public void setUnresolved(boolean unresolved) { - // The sample CRUD implementation is always resolved - } - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java deleted file mode 100644 index b212ee3c9b..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud.provider; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; - -import crud.backend.ResourceManager; - - -/** - * Implements an invoker for CRUD component implementations. - * - * The invoker is responsible for handling invocations of a business operation. - * Input business data is passed to the invoke method in a Message object. - * The invoke method is responsible for handling the invocation and returning a Message with - * the output business data. - * - * In this example we are simply delegating the CRUD operation invocations to the - * corresponding methods on our fake resource manager class. - * - * More sophisticated invokers can delegate the invocation to an implementation artifact directly - * (for example a Java class using reflection as in the implementation-pojo sample) or call a runtime - * engine like a BPEL engine or an XQuery engine for example (this is what the Tuscany - * implementation-bpel and implementation-xquery extensions do). - */ -class CRUDImplementationInvoker implements Invoker { - private Operation operation; - private ResourceManager resourceManager; - - CRUDImplementationInvoker(Operation operation, ResourceManager resourceManager) { - this.operation = operation; - this.resourceManager = resourceManager; - } - - public Message invoke(Message msg) { - try { - Object[] args = msg.getBody(); - Object resp = null; - - if (operation.getName().equals("create")) { - resp = resourceManager.createResource(args[0]); - - } else if (operation.getName().equals("retrieve")) { - resp = resourceManager.retrieveResource((String)args[0]); - - } else if (operation.getName().equals("update")) { - resp = resourceManager.updateResource((String)args[0], args[1]); - - } else if (operation.getName().equals("delete")) { - resourceManager.deleteResource((String)args[0]); - } - - msg.setBody(resp); - } catch (Exception e) { - msg.setFaultBody(e.getCause()); - } - return msg; - } - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java deleted file mode 100644 index 8f11f9d910..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package crud.provider; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -import crud.CRUDImplementation; -import crud.backend.ResourceManager; - - -/** - * An implementation provider for sample CRUD implementations. - * - * The implementation provider is responsible for handling the lifecycle of a component - * implementation and creating operation invokers for the service operations provided - * by the implementation. - * - * The start() and stop() methods are called when a component is started - * and stopped. - * - * The createInvoker method is called for each operation provided by the component - * implementation. The implementation provider can create an invoker and initialize it - * at that time to minimize the amount of work to be performed on each invocation. - */ -class CRUDImplementationProvider implements ImplementationProvider { - - private RuntimeComponent component; - private CRUDImplementation implementation; - - /** - * Constructs a new CRUD implementation. - */ - CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) { - this.component = component; - this.implementation = implementation; - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - CRUDImplementationInvoker invoker = new CRUDImplementationInvoker(operation, new ResourceManager(implementation.getDirectory())); - return invoker; - } - - public boolean supportsOneWayInvocation() { - return false; - } - - public void start() { - System.out.println("Starting " + component.getName()); - } - - public void stop() { - System.out.println("Stopping " + component.getName()); - } - -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java deleted file mode 100644 index 4566cb7155..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package crud.provider; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -import crud.CRUDImplementation; -import crud.provider.CRUDImplementationProvider; - - -/** - * A factory for CRUD implementation providers. - * - * The factory is called to create an implementation provider for each component using - * the CRUD implementation. - */ -public class CRUDImplementationProviderFactory implements ImplementationProviderFactory { - - /** - * Constructs a new CRUD implementation. - */ - public CRUDImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { - } - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) { - return new CRUDImplementationProvider(component, implementation); - } - - public Class getModelType() { - return CRUDImplementation.class; - } -} diff --git a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory b/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory deleted file mode 100644 index 3cf5de5fa1..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the implementation model factory -crud.impl.CRUDImplementationFactoryImpl diff --git a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 17c98cf706..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://crud#implementation.crud,model=crud.CRUDImplementation,factory=crud.CRUDImplementationFactory diff --git a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema deleted file mode 100644 index 527c626418..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# URI of the XML schema to be used for validation -sample-implementation-crud.xsd diff --git a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index 6ce605197a..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the implementation extension -crud.provider.CRUDImplementationProviderFactory;model=crud.CRUDImplementation diff --git a/java/sca/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd b/java/sca/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd deleted file mode 100644 index 447e31bf93..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java deleted file mode 100644 index 0bb5cfc361..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import crud.CRUD; - -/** - * Tests the CRUD implementation extension. - */ -public class CRUDTestCase extends TestCase { - - private SCADomain scaDomain; - private CRUD crudService; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("crud.composite"); - crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testCRUD() throws Exception { - String id = crudService.create("ABC"); - Object result = crudService.retrieve(id); - assertEquals("ABC", result); - - crudService.update(id, "EFG"); - result = crudService.retrieve(id); - assertEquals("EFG", result); - - crudService.delete(id); - result = crudService.retrieve(id); - assertNull(result); - } -} diff --git a/java/sca/samples/implementation-crud-extension/src/test/resources/crud.composite b/java/sca/samples/implementation-crud-extension/src/test/resources/crud.composite deleted file mode 100644 index 18745033bb..0000000000 --- a/java/sca/samples/implementation-crud-extension/src/test/resources/crud.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/implementation-crud/README b/java/sca/samples/implementation-crud/README deleted file mode 100644 index 50da631c04..0000000000 --- a/java/sca/samples/implementation-crud/README +++ /dev/null @@ -1,113 +0,0 @@ -Implementation CRUD Sample Client -================================= -This sample demonstrates how to use the new implementation extension, -implementation-crud-extension. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens, open a command prompt, -navigate to this sample directory, and do - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;..\implementation-crud-extension\target\sample-implementation-crud-extension.jar;target\sample-implementation-crud.jar crud.client.CRUDClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:../implementation-crud-extension/target/sample-implementation-crud-extension.jar:target/sample-implementation-crud.jar crud.client.CRUDClient - -This looks like a long command. The three things we add to the classpath are - -tuscany-sca-manifest.jar - all of the standard Tuscany SCA - runtime and extension classes -sample-implementation-crud-extension.jar - the new crud implementation - extension -sample-implementation-crud.jar - the application that uses the crud - implementation - -Sample Overview ---------------- -This sample contains a client application for a CRUD implementation type that -shows how to create new implementation types. See the README for the -mplementation-crud-extension sample for details of this implementation type. - -implementation-crud/ - src/ - main/ - java/ - crud/ - client/ - CRUDClient.java - sample client - resources/ - crud.composite - the SCA assembly used by this sample - - test/ - java/ - crud/ - client/ - CRUDTestCase.java - sample JUnit test case for the sample client - - implementation-crud.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd implementation-crud -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Starting CRUDServiceComponent - [java] create(ABC) in tmp - [java] retrieve(0) - [java] Result from create: ABC - [java] update(0) - [java] retrieve(0) - [java] Result from update: EFG - [java] delete(0) - [java] retrieve(0) - [java] Result from delete: null - [java] Stopping CRUDServiceComponent - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and -run using Maven as follows. - -cd implementation-crud -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running crud.client.CRUDTestCase -Starting CRUDServiceComponent -create(ABC) in tmp -retrieve(0) -update(0) -retrieve(0) -delete(0) -retrieve(0) -Stopping CRUDServiceComponent -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.641 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/implementation-crud/build.xml b/java/sca/samples/implementation-crud/build.xml deleted file mode 100644 index 10b26b5a94..0000000000 --- a/java/sca/samples/implementation-crud/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-crud/implementation-crud.png b/java/sca/samples/implementation-crud/implementation-crud.png deleted file mode 100644 index a292037e7a..0000000000 Binary files a/java/sca/samples/implementation-crud/implementation-crud.png and /dev/null differ diff --git a/java/sca/samples/implementation-crud/implementation-crud.svg b/java/sca/samples/implementation-crud/implementation-crud.svg deleted file mode 100644 index dbb37be208..0000000000 --- a/java/sca/samples/implementation-crud/implementation-crud.svg +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - crud - - CRUDServiceComponent - CRUD - diff --git a/java/sca/samples/implementation-crud/pom.xml b/java/sca/samples/implementation-crud/pom.xml deleted file mode 100644 index 3fb4252e92..0000000000 --- a/java/sca/samples/implementation-crud/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-implementation-crud - Apache Tuscany SCA CRUD Implementation Extension Sample Client - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - sample-implementation-crud-extension - 2.0-SNAPSHOT - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java b/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java deleted file mode 100644 index ea87cb3001..0000000000 --- a/java/sca/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud.client; - - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import crud.CRUD; - -/** - * A sample client that shows how to create an SCA domain, get a service, and - * invoke service methods of a CRUD component. - * - * The CRUD component uses an implementation extension - * from module implementation-crud-extension. - * - * @version $Rev$ $Date$ - */ -public class CRUDClient { - - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("crud.composite"); - CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); - - String id = crudService.create("ABC"); - - Object result = crudService.retrieve(id); - System.out.println("Result from create: " + result); - - crudService.update(id, "EFG"); - result = crudService.retrieve(id); - System.out.println("Result from update: " + result); - - crudService.delete(id); - result = crudService.retrieve(id); - System.out.println("Result from delete: " + result); - - scaDomain.close(); - } - -} diff --git a/java/sca/samples/implementation-crud/src/main/resources/crud.composite b/java/sca/samples/implementation-crud/src/main/resources/crud.composite deleted file mode 100644 index 18745033bb..0000000000 --- a/java/sca/samples/implementation-crud/src/main/resources/crud.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java b/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java deleted file mode 100644 index 7e0476a8b1..0000000000 --- a/java/sca/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package crud.client; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import crud.CRUD; - - -/** - * Tests the sample crud composite. - */ -public class CRUDTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("crud.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - CRUD crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent"); - - String id = crudService.create("ABC"); - Object result = crudService.retrieve(id); - assertEquals(result, "ABC"); - - crudService.update(id, "EFG"); - result = crudService.retrieve(id); - assertEquals(result, "EFG"); - - crudService.delete(id); - result = crudService.retrieve(id); - assertNull(result); - } -} diff --git a/java/sca/samples/implementation-notification/README b/java/sca/samples/implementation-notification/README deleted file mode 100644 index 7adfa4e5dc..0000000000 --- a/java/sca/samples/implementation-notification/README +++ /dev/null @@ -1,97 +0,0 @@ -Notification Implementation Sample -=============================== - -This sample illustrates the use of - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows, use following command: - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-implementation-notification.jar notification.TrafficAdvisoryClient - -on *nix, use following command: - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-implementation-notification.jar notification.TrafficAdvisoryClient - -OR you can also use Maven to test: - -mvn test - -Sample Overview ---------------- - -This sample consists of a single composite that contains a notification component, -a producer component and two consumer components. Take a look at the composite file -or the .svg file which shows the composite file in pictorial form. The notification -component has an that refers to the component type -that defines the TrafficAdvisory java interface. This interface indicates the -makeup of the messages being sent and received and is also implemented by the -consumer components. - -Sample directory structure: - -implementation-notification/ - src/ - main/ - java/ - notification/ - TestCaseProducer.java - interface for the producer component - TrafficAdvisory.java - interface for the notification and consumer components - TrafficAdvisoryConsumer.java - implementation for the consumer components - TrafficAdvisoryProducer.java - implementation for the producer component - test/ - java/ - notification/ - TrafficAdvisoryTestCase.java - JUnit test case - resources/ - TrafficAdvisoryNotification.componentType - the component type referred to by - - TrafficAdvisoryNotification.composite - the main composite including producer, - notification component, and consumers - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd implementation-notification -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Consumer [Consumer1] received report: Nothing to report today - [java] Consumer [Consumer2] received report: Nothing to report today - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd implementation-notification -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running notification.TrafficAdvisoryTestCase -Consumer [Consumer1] received report: Nothing to report today -Consumer [Consumer2] received report: Nothing to report today -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.742 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/implementation-notification/build.xml b/java/sca/samples/implementation-notification/build.xml deleted file mode 100644 index 110c7b84c1..0000000000 --- a/java/sca/samples/implementation-notification/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-notification/implementation-notification.png b/java/sca/samples/implementation-notification/implementation-notification.png deleted file mode 100644 index 0b7ee34bf7..0000000000 Binary files a/java/sca/samples/implementation-notification/implementation-notification.png and /dev/null differ diff --git a/java/sca/samples/implementation-notification/pom.xml b/java/sca/samples/implementation-notification/pom.xml deleted file mode 100644 index 0ebb3ff7a3..0000000000 --- a/java/sca/samples/implementation-notification/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-implementation-notification - Apache Tuscany SCA Notification Implementation Sample - 2.0-SNAPSHOT - A sample illustrating use of implementation.notification - - - - org.apache.tuscany.sca - tuscany-implementation-notification - 2.0-SNAPSHOT - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - test - - - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - install - - diff --git a/java/sca/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java b/java/sca/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java deleted file mode 100644 index bf8c72e0ce..0000000000 --- a/java/sca/samples/implementation-notification/src/main/java/notification/TestCaseProducer.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -public interface TestCaseProducer { - - public void produceTrafficNotification(String report); -} diff --git a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java b/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java deleted file mode 100644 index 7bbfda2122..0000000000 --- a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisory.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -public interface TrafficAdvisory { - - void trafficNotification(String report); -} diff --git a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java b/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java deleted file mode 100644 index da32bab58d..0000000000 --- a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryClient.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -import notification.TestCaseProducer; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class TrafficAdvisoryClient { - - public static void main(String[] args) throws Exception { - try { - SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); - - testCaseProducer.produceTrafficNotification("Nothing to report today"); - - domain.close(); - } catch(Throwable e) { - e.printStackTrace(); - if (e instanceof Exception) { - throw (Exception)e; - } - else { - throw new Exception(e); - } - } - } -} diff --git a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java b/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java deleted file mode 100644 index 17d7933d9e..0000000000 --- a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryConsumer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * @version $Rev$ $Date$ - */ -@Service(TrafficAdvisory.class) -@Scope("COMPOSITE") -public class TrafficAdvisoryConsumer implements TrafficAdvisory { - - @Property - protected String name; - - public void trafficNotification(String report) { - - System.out.println("Consumer [" + name + "] received report: " + report); - } -} diff --git a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java b/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java deleted file mode 100644 index e16b509993..0000000000 --- a/java/sca/samples/implementation-notification/src/main/java/notification/TrafficAdvisoryProducer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -@Service(TestCaseProducer.class) -@Scope("COMPOSITE") -public class TrafficAdvisoryProducer implements TestCaseProducer { - - @Reference - protected TrafficAdvisory destination; - - public void produceTrafficNotification(String report) { - - destination.trafficNotification(report); - } -} diff --git a/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType b/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType deleted file mode 100644 index 873e200613..0000000000 --- a/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.componentType +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite b/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite deleted file mode 100644 index bbf2281352..0000000000 --- a/java/sca/samples/implementation-notification/src/main/resources/TrafficAdvisoryNotification.composite +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - Consumer1 - - - - - Consumer2 - - - diff --git a/java/sca/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java b/java/sca/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java deleted file mode 100644 index 719141c94b..0000000000 --- a/java/sca/samples/implementation-notification/src/test/java/notification/TrafficAdvisoryTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package notification; - -import junit.framework.TestCase; - -import notification.TestCaseProducer; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class TrafficAdvisoryTestCase extends TestCase { - - private SCADomain domain; - private TestCaseProducer testCaseProducer; - - public void testTrafficAdvisoryNotification() throws Exception { - try { - testCaseProducer.produceTrafficNotification("Nothing to report today"); - } catch(Throwable e) { - e.printStackTrace(); - } - } - - @Override - protected void setUp() throws Exception { - try { - domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite"); - testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer"); - } catch(Throwable e) { - e.printStackTrace(); - if (e instanceof Exception) { - throw (Exception)e; - } - else { - throw new Exception(e); - } - } - } - - @Override - protected void tearDown() throws Exception { - domain.close(); - } -} diff --git a/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType b/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType deleted file mode 100644 index 873e200613..0000000000 --- a/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.componentType +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite b/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite deleted file mode 100644 index bbf2281352..0000000000 --- a/java/sca/samples/implementation-notification/src/test/resources/TrafficAdvisoryNotification.composite +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - Consumer1 - - - - - Consumer2 - - - diff --git a/java/sca/samples/implementation-pojo-extension/README b/java/sca/samples/implementation-pojo-extension/README deleted file mode 100644 index 3b201779e1..0000000000 --- a/java/sca/samples/implementation-pojo-extension/README +++ /dev/null @@ -1,70 +0,0 @@ -Implementation POJO Sample -========================== -This sample demonstrates how new implementation types are constructed for -Apache Tuscany SCA. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -Sample Overview ---------------- -This sample contains a POJO implementation type as an example of how to create -new implementation types. - -implementation-pojo-extension/ - src/ - main/ - java/ - pojo/ - implementation model interfaces - impl/ - implementations of the model interfaces - provider/ - runtime implementation - resources/ - META-INF/ - services/ - declares the extension - test/ - java/ - helloworld/ - HelloWorldTestCase.java - JUnit test case - resources/ - helloworld.composite - the SCA assembly used during unit testing - - build.xml - the Ant build file - pom.xml - the Maven build file - -Building The Sample Extension Using Ant ------------------------------------------ -With the binary distribution the sample extension can be built using Ant as -follows - -cd implementation-pojo-extension -ant compile - -Building The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built -using Maven as follows. - -cd implementation-pojo-extension -mvn - -Maven will also test that the sample extension built properly. You should see -the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running helloworld.HelloWorldTestCase -Initializing POJO -Initializing POJO -Executing POJO sayHello -Initializing POJO -Initializing POJO -Executing POJO sayHello -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.616 sec - -Results : - -Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/implementation-pojo-extension/build.xml b/java/sca/samples/implementation-pojo-extension/build.xml deleted file mode 100644 index 78bae79859..0000000000 --- a/java/sca/samples/implementation-pojo-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-pojo-extension/pom.xml b/java/sca/samples/implementation-pojo-extension/pom.xml deleted file mode 100644 index 6fa7ab7f1c..0000000000 --- a/java/sca/samples/implementation-pojo-extension/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-implementation-pojo-extension - Apache Tuscany SCA POJO Implementation Extension Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-assembly-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - test - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java deleted file mode 100644 index 7c2f5d236f..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package pojo; - -import java.lang.reflect.Method; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.Implementation; - - -/** - * Represents a POJO implementation in an SCA assembly. - * - * @version $Rev$ $Date$ - */ -public interface POJOImplementation extends Implementation { - - /** - * Returns the POJO class name - * @return - */ - public String getPOJOName(); - - /** - * Sets the POJO class name - * @param pojoName - */ - public void setPOJOName(String pojoName); - - /** - * Returns the POJO class. - * @return - */ - public Class getPOJOClass(); - - /** - * Sets the POJO class. - * @param pojoClass - */ - public void setPOJOClass(Class pojoClass); - - /** - * Returns the POJO's methods. - * @return - */ - public Map getMethods(); - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java deleted file mode 100644 index bbcfb3d0dc..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package pojo; - - -/** - * Factory for the POJO implementation model. - * - * @version $Rev$ $Date$ - */ -public interface POJOImplementationFactory { - - /** - * Creates a new POJO implementation model object. - * @return a new POJO implementation model object - */ - POJOImplementation createPOJOImplementation(); - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java deleted file mode 100644 index 0dad270a6c..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package pojo.impl; - -import pojo.POJOImplementation; -import pojo.POJOImplementationFactory; - -/** - * A factory for the POJO implementation model. - * - * @version $Rev$ $Date$ - */ -public class POJOImplementationFactoryImpl implements POJOImplementationFactory { - - public POJOImplementation createPOJOImplementation() { - return new POJOImplementationImpl(); - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java deleted file mode 100644 index f2d6871039..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package pojo.impl; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; - -import pojo.POJOImplementation; - - -/** - * Represents a POJO implementation in an SCA assembly. - * - * @version $Rev$ $Date$ - */ -class POJOImplementationImpl implements POJOImplementation { - - private String pojoName; - private Class pojoClass; - private String uri; - private Map methods; - private List services = new ArrayList(); - private List references = new ArrayList(); - private List properties = new ArrayList(); - private boolean unresolved; - - POJOImplementationImpl() { - } - - /** - * Returns the POJO class name - * @return - */ - public String getPOJOName() { - return pojoName; - } - - /** - * Sets the POJO class name - * @param pojoName - */ - public void setPOJOName(String pojoName) { - this.pojoName = pojoName; - setURI(pojoName.replace('.', '/')); - } - - /** - * Returns the POJO class. - * @return - */ - public Class getPOJOClass() { - return pojoClass; - } - - /** - * Sets the POJO class. - * @param pojoClass - */ - public void setPOJOClass(Class pojoClass) { - this.pojoClass = pojoClass; - setPOJOName(pojoClass.getName()); - - // Index the POJO's methods - methods = new HashMap(); - Method[] m = pojoClass.getMethods(); - for (int i = 0; i < m.length; i++) { - methods.put(m[i].getName(), m[i]); - } - } - - /** - * Returns the POJO's methods. - * @return - */ - public Map getMethods() { - return methods; - } - - public ConstrainingType getConstrainingType() { - // The sample POJO implementation does not support constrainingTypes - return null; - } - - public List getProperties() { - return properties; - } - - public List getServices() { - return services; - } - - public List getReferences() { - return references; - } - - public String getURI() { - return uri; - } - - public void setConstrainingType(ConstrainingType constrainingType) { - // The sample POJO implementation does not support constrainingTypes - } - - public void setURI(String uri) { - this.uri = uri; - } - - public boolean isUnresolved() { - return unresolved; - } - - public void setUnresolved(boolean unresolved) { - this.unresolved = unresolved; - } - - @Override - public int hashCode() { - return uri.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof POJOImplementationImpl) { - return ((POJOImplementationImpl)obj).getURI().equals(uri); - } else { - return false; - } - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java deleted file mode 100644 index 44a2cc0aa8..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package pojo.impl; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ClassReference; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; -import org.apache.tuscany.sca.interfacedef.java.JavaInterface; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.policy.PolicyFactory; - -import pojo.POJOImplementation; -import pojo.POJOImplementationFactory; - -/** - * Implements a STAX based artifact processor for POJO implementations. - * - * The artifact processor is responsible for processing - * elements in SCA assembly XML composite files and populating the POJO - * implementation model, resolving its references to other artifacts in the SCA - * contribution, and optionally write the model back to SCA assembly XML. - */ -public class POJOImplementationProcessor implements StAXArtifactProcessor { - private static final QName IMPLEMENTATION_POJO = new QName("http://pojo", "implementation.pojo"); - - private AssemblyFactory assemblyFactory; - private JavaInterfaceFactory javaFactory; - private POJOImplementationFactory pojoImplementationFactory; - private PolicyFactory policyFactory; - private PolicyAttachPointProcessor policyProcessor; - - public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - - // Get the assembly and Java interface factories as we'll need them to - // create model objects - assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - policyFactory = modelFactories.getFactory(PolicyFactory.class); - pojoImplementationFactory = modelFactories.getFactory(POJOImplementationFactory.class); - policyProcessor = new PolicyAttachPointProcessor(policyFactory); - } - - public QName getArtifactType() { - // Returns the qname of the XML element processed by this processor - return IMPLEMENTATION_POJO; - } - - public Class getModelType() { - // Returns the type of model processed by this processor - return POJOImplementation.class; - } - - public POJOImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - - // Read an element - POJOImplementation implementation = pojoImplementationFactory.createPOJOImplementation(); - - // Read policies - policyProcessor.readPolicies(implementation, reader); - - // Read the POJO class attribute. - String className = reader.getAttributeValue(null, "class"); - implementation.setPOJOName(className); - - // Mark the POJO model unresolved to track the fact that it's not - // completely initialized, its class is not loaded yet and services - // and references not initialized either - implementation.setUnresolved(true); - - // Skip to end element - while (reader.hasNext()) { - if (reader.next() == END_ELEMENT && IMPLEMENTATION_POJO.equals(reader.getName())) { - break; - } - } - - return implementation; - } - - public void resolve(POJOImplementation implementation, ModelResolver resolver) throws ContributionResolveException { - - // Resolve the POJO implementation - - // First resolve its class - ClassReference classReference = new ClassReference(implementation.getPOJOName()); - classReference = resolver.resolveModel(ClassReference.class, classReference); - Class pojoClass = classReference.getJavaClass(); - if (pojoClass == null) { - throw new ContributionResolveException("Class could not be resolved: " + implementation.getPOJOName()); - } - implementation.setPOJOClass(pojoClass); - - // Check to see if we have a .componentType file describing the POJO class - ComponentType componentType = assemblyFactory.createComponentType(); - componentType.setUnresolved(true); - componentType.setURI(implementation.getURI() + ".componentType"); - componentType = resolver.resolveModel(ComponentType.class, componentType); - if (!componentType.isUnresolved()) { - - // We have a component type description, merge it into the POJO model - implementation.getServices().addAll(componentType.getServices()); - implementation.getReferences().addAll(componentType.getReferences()); - implementation.getProperties().addAll(componentType.getProperties()); - - } else { - - // We have no component type description, simply introspect the POJO and - // create a single Service for it - Service service = assemblyFactory.createService(); - service.setName(pojoClass.getSimpleName()); - JavaInterface javaInterface; - try { - javaInterface = javaFactory.createJavaInterface(pojoClass); - } catch (InvalidInterfaceException e) { - throw new ContributionResolveException(e); - } - JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract(); - interfaceContract.setInterface(javaInterface); - service.setInterfaceContract(interfaceContract); - implementation.getServices().add(service); - } - - // Mark the implementation resolved now - implementation.setUnresolved(false); - } - - public void write(POJOImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - // Write element - policyProcessor.writePolicyPrefixes(implementation, writer); - writer.writeStartElement(IMPLEMENTATION_POJO.getNamespaceURI(), IMPLEMENTATION_POJO.getLocalPart()); - policyProcessor.writePolicyAttributes(implementation, writer); - - if (implementation.getPOJOName() != null) { - writer.writeAttribute("class", implementation.getPOJOName()); - } - - writer.writeEndElement(); - } -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java deleted file mode 100644 index 0654cb93e5..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package pojo.provider; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.oasisopen.sca.ServiceRuntimeException; - -/** - * Implements an invoker for POJO component implementations. - * - * The invoker is responsible for handling invocations of a business operation. - * Input business data is passed to the invoke method in a Message object. - * The invoke method is responsible for handling the invocation and returning a Message with - * the output business data. - * - * In this example we are simply delegating the operation invocations to the - * corresponding methods on the POJO implementation class using Java reflection. - * - * Depending on the type of implementation being handled, more sophisticated invokers can - * use other techniques to delegate the invocation to the implementation artifact directly, call a - * runtime engine like a BPEL engine or an XQuery engine (this is what the Tuscany - * implementation-bpel and implementation-xquery extensions do) or just completely handle the - * invocation in the invoker itself if the implementation has a fixed behavior for example. - */ -class POJOImplementationInvoker implements Invoker { - - private Object pojoInstance; - private Method method; - - POJOImplementationInvoker(Object pojoInstance, Operation operation, Method method) { - this.pojoInstance = pojoInstance; - this.method = method; - } - - public Message invoke(Message msg) { - try { - msg.setBody(method.invoke(pojoInstance, (Object[])msg.getBody())); - } catch (InvocationTargetException e) { - msg.setFaultBody(e); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - return msg; - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java deleted file mode 100644 index 30a9885ea9..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package pojo.provider; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; -import org.oasisopen.sca.ServiceRuntimeException; - -import pojo.POJOImplementation; - -/** - * An implementation provider for sample CRUD implementations. - * - * The implementation provider is responsible for handling the lifecycle of a component - * implementation and creating operation invokers for the service operations provided - * by the implementation. - * - * The start() and stop() methods are called when a component is started - * and stopped. In this example we are using that opportunity to call init and destroy methods - * on the POJO instance if these methods exist. - * - * The createInvoker method is called for each operation provided by the component - * implementation. The implementation provider can create an invoker and initialize it - * at that time to minimize the amount of work to be performed on each invocation. - * - * For example here we are looking up the Java method corresponding to the service operation - * at passing it to the invoker constructor. This way the invoker won't have to lookup the Java - * method on each invocation. - */ -class POJOImplementationProvider implements ImplementationProvider { - - private POJOImplementation implementation; - private Object pojoInstance; - - /** - * Constructs a new CRUD implementation. - */ - POJOImplementationProvider(RuntimeComponent component, POJOImplementation implementation) { - this.implementation = implementation; - - // Create a new instance of the POJO - try { - pojoInstance = implementation.getPOJOClass().newInstance(); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } - - public void start() { - try { - // Invoke the POJO's init method - Method initMethod = implementation.getMethods().get("init"); - if (initMethod != null) { - initMethod.invoke(pojoInstance); - } - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } - - public void stop() { - try { - // Invoke the POJO's destroy method - Method destroyMethod = implementation.getMethods().get("destroy"); - if (destroyMethod != null) { - destroyMethod.invoke(pojoInstance); - } - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } finally { - pojoInstance = null; - } - } - - public Invoker createInvoker(RuntimeComponentService service, Operation operation) { - Method method = implementation.getMethods().get(operation.getName()); - POJOImplementationInvoker invoker = new POJOImplementationInvoker(pojoInstance, operation, method); - return invoker; - } - - public boolean supportsOneWayInvocation() { - return false; - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java b/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java deleted file mode 100644 index 22f2be09e9..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package pojo.provider; - -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.ImplementationProvider; -import org.apache.tuscany.sca.provider.ImplementationProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -import pojo.POJOImplementation; - -/** - * A factory for POJO implementation providers. - */ -public class POJOImplementationProviderFactory implements ImplementationProviderFactory { - - public POJOImplementationProviderFactory(ExtensionPointRegistry registry) { - } - - public Class getModelType() { - // Returns the type of model processed by this processor - return POJOImplementation.class; - } - - public ImplementationProvider createImplementationProvider(RuntimeComponent component, POJOImplementation implementation) { - return new POJOImplementationProvider(component, implementation); - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 8337e81c5f..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -pojo.impl.POJOImplementationProcessor;qname=http://pojo#implementation.pojo,model=pojo.POJOImplementation,factory=pojo.POJOImplementationFactory diff --git a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema deleted file mode 100644 index 64dd230a15..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# URI of the XML schema to be used for validation -sample-implementation-pojo.xsd diff --git a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index b30ea3b9cf..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the implementation extension -pojo.provider.POJOImplementationProviderFactory;model=pojo.POJOImplementation diff --git a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory b/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory deleted file mode 100644 index 075af98240..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for implementation model factory -pojo.impl.POJOImplementationFactoryImpl diff --git a/java/sca/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd b/java/sca/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd deleted file mode 100644 index c9d170770b..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java b/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java deleted file mode 100644 index cc32929f09..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -public interface HelloWorld { - - String sayHello(String name); - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java b/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 0580e30aba..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -public class HelloWorldImpl { - - public void init() { - System.out.println("Initializing POJO"); - } - - public void destroy() { - System.out.println("Destroying POJO"); - } - - public String sayHello(String name) { - System.out.println("Executing POJO sayHello"); - return "Hello " + name; - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java b/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java deleted file mode 100644 index 69ab1f567e..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -public class HelloWorldImpl2 { - - public void init() { - System.out.println("Initializing POJO"); - } - - public void destroy() { - System.out.println("Destroying POJO"); - } - - public String sayHello(String name) { - System.out.println("Executing POJO sayHello"); - return "Hello " + name; - } - -} diff --git a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java b/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java deleted file mode 100644 index d8b5f41adc..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Tests the POJO implementation extension. - */ -public class HelloWorldTestCase extends TestCase { - - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testHello() throws Exception { - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); - assertEquals("Hello petra", helloworld.sayHello("petra")); - } - - public void testHello2() throws Exception { - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent2/HelloWorld2"); - assertEquals("Hello petra", helloworld.sayHello("petra")); - } -} diff --git a/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType b/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType deleted file mode 100644 index a92c5ab8db..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite b/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite deleted file mode 100644 index c38094dfc9..0000000000 --- a/java/sca/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/java/sca/samples/loanapplication/pom.xml b/java/sca/samples/loanapplication/pom.xml deleted file mode 100644 index ad76cde4f1..0000000000 --- a/java/sca/samples/loanapplication/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-loanapplication - Apache Tuscany SCA Loan Application Conversation Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java deleted file mode 100644 index 4fedb70782..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplication.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -public class LoanApplication { - - private String customerName; - private float loanAmount; - - public LoanApplication(String customerName, float loanAmount) { - this.customerName = customerName; - this.loanAmount = loanAmount; - } - - @Override - public String toString() { - return "[Customer: " + customerName + ", loan amount: " - + loanAmount + "]"; - } -} diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java deleted file mode 100644 index 5183ece867..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanApplicationClient.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - - -public class LoanApplicationClient { - - public static void main(String[] args) throws Exception { - SCADomain domain = SCADomain.newInstance("loanapplication.composite"); - - // Locate the MyClient component and invoke it - LoanClient loanClient = domain.getService(LoanClient.class, "LoanClientComponent"); - loanClient.applyForLoan("John Doe", 1000.0f); - System.out.println(loanClient.displayLoan()); - System.out.println("Loan approved: " + loanClient.isApproved()); - - domain.close(); - } -} diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClient.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClient.java deleted file mode 100644 index 7e4438bbff..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClient.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -public interface LoanClient { - - void applyForLoan(String customerName, float amount); - boolean isApproved(); - boolean isCancelled(); - String displayLoan(); - void cancelLoan(); - void closeLoan(); -} diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java deleted file mode 100644 index 023199b14b..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanClientImpl.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class LoanClientImpl implements LoanClient { - - private LoanService loanService; - - @Reference - public void setLoanService(LoanService loanService) { - this.loanService = loanService; - } - - public void applyForLoan(String customerName, float amount) { - loanService.apply(new LoanApplication(customerName, amount)); - } - - public boolean isApproved() { - if (loanService.getLoanStatus() == null) { - return false; - } - return loanService.getLoanStatus().equals("approved"); - } - - public boolean isCancelled() { - if (loanService.getLoanStatus() == null) { - return false; - } - return loanService.getLoanStatus().equals("cancelled"); - } - - public String displayLoan() { - return loanService.display(); - } - - public void cancelLoan() { - loanService.cancelApplication(); - } - - public void closeLoan() { - loanService.close(); - } -} diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanService.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanService.java deleted file mode 100644 index 8d16b04caf..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -import org.oasisopen.sca.annotation.Conversational; -import org.oasisopen.sca.annotation.EndsConversation; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -@Conversational -@Remotable -public interface LoanService { - - void apply(LoanApplication application); - - void lockCurrentRate(int termInYears); - - @OneWay - void cancelApplication(); - - String getLoanStatus(); - - String display(); - - @EndsConversation - void close(); -} diff --git a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java b/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java deleted file mode 100644 index a88dc0b56b..0000000000 --- a/java/sca/samples/loanapplication/src/main/java/loanapplication/LoanServiceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.ConversationID; -import org.oasisopen.sca.annotation.Scope; - -@Scope("CONVERSATION") -@AllowsPassByReference -public class LoanServiceImpl implements LoanService { - - private LoanApplication application; - private String status; - private int termLocked = 0; - @ConversationID - protected String conversationID; - - public void apply(LoanApplication application) { - this.application = application; - status = "open"; - } - - public void lockCurrentRate(int termInYears) { - termLocked = termInYears; - status = "locked"; - } - - public void cancelApplication() { - status = "cancelled"; - } - - public String getLoanStatus() { - return status; - } - - public String display() { - return "Loan application: " + application + ", term: " - + termLocked + ", status: " + status - + ", conversationID: " + conversationID; - } - - public void close() { - this.application = null; - this.status = "closed"; - } -} diff --git a/java/sca/samples/loanapplication/src/main/resources/loanapplication.composite b/java/sca/samples/loanapplication/src/main/resources/loanapplication.composite deleted file mode 100644 index 3aa8d030b7..0000000000 --- a/java/sca/samples/loanapplication/src/main/resources/loanapplication.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java b/java/sca/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java deleted file mode 100644 index e88e48a53a..0000000000 --- a/java/sca/samples/loanapplication/src/test/java/loanapplication/LoanApplicationTestCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package loanapplication; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class LoanApplicationTestCase extends TestCase { - - private LoanClient loanClient; - private SCADomain domain; - - @Override - protected void setUp() throws Exception { - domain = SCADomain.newInstance("loanapplication.composite"); - - loanClient = domain.getService(LoanClient.class, "LoanClientComponent"); - } - - @Override - protected void tearDown() throws Exception { - domain.close(); - } - - public void test() throws Exception { - try { - loanClient.applyForLoan("John Doe", 1000.0f); - System.out.println("Applied: " + loanClient.displayLoan()); - System.out.println("Loan approved: " + loanClient.isApproved()); - loanClient.cancelLoan(); - System.out.println("Sleeping to let cancel complete ..."); - Thread.sleep(500); - if (!loanClient.isCancelled()) { - fail("Loan should be cancelled"); - } - System.out.println("Cancelled: " + loanClient.displayLoan()); - loanClient.closeLoan(); - - /* This is a mistake, after @EndsConversation, a new conversation is - * started automatically, so we should not get TargetNotFoundException. - * Keep this for the timeout case, where we should get the exception - try { - System.out.println("Trying to use the closed loan in the ended conversation ..."); - System.out.println("Closed: " + loanClient.displayLoan()); - fail("Target should not be found"); - } catch(TargetNotFoundException e) { - System.out.println("Target not found as expected"); - } - */ - - // Now check that a new conversation's loan is not cancelled - - if (loanClient.isCancelled()) { - fail("Loan should not be cancelled"); - } - } catch(Throwable e) { - e.printStackTrace(); - if (e instanceof Exception) { - throw (Exception)e; - } - if (e instanceof Error) { - throw (Error)e; - } - } - } -} diff --git a/java/sca/samples/osgi-supplychain/README b/java/sca/samples/osgi-supplychain/README deleted file mode 100644 index 11fecf2ae8..0000000000 --- a/java/sca/samples/osgi-supplychain/README +++ /dev/null @@ -1,161 +0,0 @@ -osgi-supplychain Sample -======================= - -The Tuscany OSGi supply chain sample shows using the Tuscany SCA runtime in a J2SE environment executing the SCA asynchronous API with OSGi and Java implementation types. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -In the directory samples\osgi-supplychain use the JDK 1.5 java command to run the class supplychain.SupplyChainClient - -Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-osgi-supplychain.jar supplychain.SupplyChainClient -Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-osgi-supplychain.jar supplychain.SupplyChainClient - -Results ----------- -The sample when run should simply display on the standard output some startup messages followed by: - -Work thread Thread[Thread-1,5,main] - Order, submitted, fulfilled, shipped - - -Sample Overview ---------------- - -The sample provides a Customer service with a purchaseGoods operation -and a notifyShipment operation annotated with the SCA @OneWay annotation. -The SupplyChainClient exercises this interface by calling the -purchaseGoods operation. This results in messages passing to -the Retailer, Warehouse, and Shipper components and the result returned -to the Customer service on a separate callback thread. The Customer -and Shipper components are implemented as OSGi bundles which use -implementation.osgi, while the Retailer and Warehouse components are -implemented using implementation.java. - - -src -+---main - +---java - ¦ +---supplychain - ¦ OSGiBundleImpl.java - ¦ SupplyChainClient.java - ¦ +---customer - ¦ Customer.java - ¦ JavaCustomerComponentImpl.java - ¦ OSGiCustomerComponentImpl.java - ¦ OSGiCustomerImpl.java - ¦ +---retailer - ¦ Retailer.java - ¦ JavaRetailerComponentImpl.java - ¦ OSGiRetailerComponentImpl.java - ¦ OSGiRetailerImpl.java - ¦ +---shipper - ¦ Shipper.java - ¦ JavaShipperComponentImpl.java - ¦ OSGiShipperComponentImpl.java - ¦ OSGiShipperImpl.java - ¦ +---warehouse - ¦ Warehouse.java - ¦ JavaWarehouseComponentImpl.java - ¦ OSGiWarehouseComponentImpl.java - ¦ OSGiWarehouseImpl.java - ¦ - +---resources - ¦ +---osgi - ¦ Customer.mf - ¦ Retailer.mf - ¦ Shipper.mf - ¦ Warehouse.mf - ¦ +---ds - ¦ Customer.mf - ¦ Retailer.mf - ¦ Shipper.mf - ¦ Warehouse.mf - ¦ Customer.xml - ¦ Retailer.xml - ¦ Shipper.xml - ¦ Warehouse.xml - ¦ Customer.componentType - ¦ Retailer.componentType - ¦ Shipper.componentType - ¦ Warehouse.componentType - ¦ supplychain.composite - ¦-- supplychain.ds.composite - - - build.xml - the Ant build file - pom.xml - the Maven build file - -Understanding OSGI implementation files ---------------------------------------- -Some of the files introduced by OSGI implementation are explained below. - -OSG files related to customer. java are: -OSGiCustomerComponentImpl.java: OSGi Declarative Services Implementation of the SCA Customer component. -OSGiCustomerImpl.java: OSGi Procedural Services Implementation of the SCA Customer component. - -You notice the same pattern for shipper.java, retailer.java, SupplyChainClient.java. - -The rest of OSGI related files are: -OSGiBundleImpl.java: Common code for OSGi Procedural Services Implementation of the SCA components - -resources/osgi/*.mf: Manifest files for OSGi bundles for OSGi procedural services implementation - -resources/osgi/ds/*.m:f Manifest files for OSGi bundles for OSGi declarative services implementation - -resources/osgi/ds/*.xml: OSGi Declarative services component xml files - -resources/*.componentType: Component types used by OSGi implementation provider for SCA - -resources/supplychain.composite: Composite file using OSGi and Java implementation types - -resources/supplychain.ds.composite: Composite file using OSGi (declarative services) and Java implementation types - -Building And Running The Sample Using Ant ------------------------------------------ -cd osgi-supplychain -ant compile -ant run - -you should see: -Buildfile: build.xml - -run: - [java] Main thread Thread[main,5,main] - [java] Started OSGi bundle with activator OSGiCustomerImpl - [java] Started OSGi bundle with activator OSGiShipperImpl - [java] Main thread sleeping ... - [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfi -lled, shipped - [java] Stop OSGi bundle with activator OSGiShipperImpl - [java] Stop OSGi bundle with activator OSGiCustomerImpl - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd osgi-supplychain -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running supplychain.SupplyChainClientTestCase -Started OSGi bundle with activator OSGiCustomerImpl -Started OSGi bundle with activator OSGiShipperImpl -Sleeping ... -Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shippe -d -Test complete -Stop OSGi bundle with activator OSGiShipperImpl -Stop OSGi bundle with activator OSGiCustomerImpl -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.062 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/osgi-supplychain/build-bundles.xml b/java/sca/samples/osgi-supplychain/build-bundles.xml deleted file mode 100644 index 7a31e6016b..0000000000 --- a/java/sca/samples/osgi-supplychain/build-bundles.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/build.xml b/java/sca/samples/osgi-supplychain/build.xml deleted file mode 100644 index 2e103e5a15..0000000000 --- a/java/sca/samples/osgi-supplychain/build.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/osgi-supplychain.png b/java/sca/samples/osgi-supplychain/osgi-supplychain.png deleted file mode 100644 index 2bec57ac8a..0000000000 Binary files a/java/sca/samples/osgi-supplychain/osgi-supplychain.png and /dev/null differ diff --git a/java/sca/samples/osgi-supplychain/osgi-supplychain.svg b/java/sca/samples/osgi-supplychain/osgi-supplychain.svg deleted file mode 100644 index 43cb427944..0000000000 --- a/java/sca/samples/osgi-supplychain/osgi-supplychain.svg +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - supplychain - - CustomerComponent - - - RetailerComponent - - - WharehouseComponent - - - ShipperComponent - - - - - - OSGi - Java - Java - OSGi - - diff --git a/java/sca/samples/osgi-supplychain/pom.xml b/java/sca/samples/osgi-supplychain/pom.xml deleted file mode 100644 index a3140094c5..0000000000 --- a/java/sca/samples/osgi-supplychain/pom.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-osgi-supplychain - Apache Tuscany SCA OSGi Supply Chain Sample - - - - - org.apache.felix - org.apache.felix.main - 1.0.4 - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-osgi - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - sample-osgi-supplychain - - - org.apache.maven.plugins - maven-antrun-plugin - 1.1 - - - - ant - ant-trax - 1.6.5 - - - - - - create-bundles - generate-test-sources - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java deleted file mode 100644 index 5f40054ada..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/OSGiBundleImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - - -import java.lang.reflect.Field; -import java.util.Hashtable; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceReference; - - -/** - * Common code for all OSGi bundles which dont use declarative services. - * Registers services and sets references. - */ -public class OSGiBundleImpl implements ServiceListener, BundleActivator { - - - String name; - String serviceName; - String[] references; - Class[] referenceClasses; - Field[] referenceFields; - - Class myClass; - - private BundleContext bundleContext; - - public OSGiBundleImpl(String serviceName, String... references) { - - myClass = this.getClass(); - this.name = this.getClass().getSimpleName(); - this.serviceName = serviceName; - this.references = references; - - try { - referenceClasses = new Class[references.length]; - referenceFields = new Field[references.length]; - for (int i = 0; i < references.length; i++) { - referenceFields[i] = this.getClass().getDeclaredField(references[i]); - referenceFields[i].setAccessible(true); - referenceClasses[i] = referenceFields[i].getType(); - } - - } catch (Exception e) { - throw new RuntimeException(e); - } - - } - - public void start(BundleContext bc) { - - System.out.println("Started OSGi bundle with activator " + name); - - this.bundleContext = bc; - - bundleContext.registerService(serviceName, this, new Hashtable()); - - for (int i = 0; i < references.length; i++) { - - try { - - ServiceReference ref = bundleContext.getServiceReference(referenceClasses[i].getName()); - if (ref != null) { - Object obj = bundleContext.getService(ref); - referenceFields[i].set(this, referenceClasses[i].cast(obj)); - } else { - String filter = "(objectclass=" + referenceClasses[i].getName() + ")"; - this.bundleContext.addServiceListener(this, filter); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - } - - public void stop(BundleContext bc) { - System.out.println("Stop OSGi bundle with activator " + name); - - } - - - public void serviceChanged(ServiceEvent event) { - try { - if (event.getType() == ServiceEvent.REGISTERED) { - - ServiceReference ref = event.getServiceReference(); - Object obj = bundleContext.getService(ref); - for (int i = 0; i < references.length; i++) { - if (referenceClasses[i].isAssignableFrom(obj.getClass())) { - referenceFields[i].set(this, referenceClasses[i].cast(obj)); - } - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java deleted file mode 100644 index 64814487cb..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/SupplyChainClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import supplychain.customer.Customer; - - -/** - * This client program shows how to create an SCA runtime, start it, - * locate a Customer service component and invoke it. - */ -public class SupplyChainClient { - - public static final void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("supplychain.composite"); - Customer customer = scaDomain.getService(Customer.class, "CustomerComponent"); - - System.out.println("Main thread " + Thread.currentThread()); - customer.purchaseGoods(); - System.out.println("Main thread sleeping ..."); - Thread.sleep(1000); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java deleted file mode 100644 index b70ddede4f..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/Customer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.customer; - -import org.oasisopen.sca.annotation.OneWay; - -/** - * This is the business interface of the Customer service component. - */ -public interface Customer { - - public void purchaseGoods(); - - @OneWay - public void notifyShipment(String order); - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java deleted file mode 100644 index cad0749218..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/JavaCustomerComponentImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.customer; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component (POJO implementation). - */ -@Service(Customer.class) -@Scope("COMPOSITE") -public class JavaCustomerComponentImpl implements Customer { - - private Retailer retailer; - - @Reference - public void setRetailer(Retailer retailer) { - this.retailer = retailer; - } - - public void purchaseGoods() { - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java deleted file mode 100644 index a1c7fce60a..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerComponentImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.customer; - - -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component (OSGi declarative services implementation). - */ -public class OSGiCustomerComponentImpl implements Customer { - - - private Retailer retailer; - - - protected void setRetailer(Retailer retailer) { - this.retailer = retailer; - } - - protected void unsetRetailer(Retailer retailer) { - this.retailer = null; - } - - public void purchaseGoods() { - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java deleted file mode 100644 index 4647a716c7..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/customer/OSGiCustomerImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.customer; - - -import supplychain.OSGiBundleImpl; -import supplychain.retailer.Retailer; - -/** - * This class implements the Customer service component (OSGi procedural services implementation). - */ -public class OSGiCustomerImpl extends OSGiBundleImpl implements Customer { - - private Retailer retailer; - - public OSGiCustomerImpl() { - super("supplychain.customer.Customer", "retailer"); - - } - - public void purchaseGoods() { - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java deleted file mode 100644 index 4c2c8d7604..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/JavaRetailerComponentImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.retailer; - - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Retailer service component (POJO implementation). - */ -@Service(Retailer.class) -@Scope("STATELESS") -public class JavaRetailerComponentImpl implements Retailer { - - private Warehouse warehouse; - - - @Reference - public void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } - - - public void submitOrder(String order) { - - warehouse.fulfillOrder(order + ", submitted"); - - } - - - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java deleted file mode 100644 index 1b7fb15bf1..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerComponentImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.retailer; - -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Retailer service component (OSGi declarative services implementation). - */ -public class OSGiRetailerComponentImpl implements Retailer { - - private Warehouse warehouse; - - - protected void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } - - protected void unsetWarehouse(Warehouse warehouse) { - this.warehouse = null; - } - - public void submitOrder(String order) { - - warehouse.fulfillOrder(order + ", submitted"); - - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java deleted file mode 100644 index e97331c06c..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/OSGiRetailerImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.retailer; - - -import supplychain.OSGiBundleImpl; -import supplychain.warehouse.Warehouse; - -/** - * This class implements the Retailer service component (OSGi procedural services implementation). - */ -public class OSGiRetailerImpl extends OSGiBundleImpl implements Retailer { - - private Warehouse warehouse; - - public OSGiRetailerImpl() { - - super("supplychain.retailer.Retailer", "warehouse"); - } - - public void submitOrder(String order) { - warehouse.fulfillOrder(order + ", submitted"); - - } - - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java deleted file mode 100644 index 1e87d59af1..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/retailer/Retailer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.retailer; - -/** - * This is the business interface of the Retailer service component. - */ -public interface Retailer { - - public void submitOrder(String order); - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java deleted file mode 100644 index 8f1276c4e7..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/JavaShipperComponentImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.shipper; - - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component (POJO implementation). - */ -@Service(Shipper.class) -@Scope("COMPOSITE") -public class JavaShipperComponentImpl implements Shipper { - - private Customer customer; - - @Reference - public void setCustomer(Customer customer) { - this.customer = customer; - } - - public void processShipment(String order) { - customer.notifyShipment(order + ", shipped"); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java deleted file mode 100644 index 0f88cca213..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperComponentImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.shipper; - - -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component (OSGi declarative services implementation). - */ -public class OSGiShipperComponentImpl implements Shipper { - - private Customer customer; - - - protected void setCustomer(Customer customer) { - this.customer = customer; - } - - protected void unsetCustomer(Customer customer) { - this.customer = null; - } - - public void processShipment(String order) { - customer.notifyShipment(order + ", shipped"); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java deleted file mode 100644 index f55a068ede..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/OSGiShipperImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.shipper; - - -import supplychain.OSGiBundleImpl; -import supplychain.customer.Customer; - -/** - * This class implements the Shipper service component (OSGi procedural services implementation). - */ -public class OSGiShipperImpl extends OSGiBundleImpl implements Shipper { - - private Customer customer; - - public OSGiShipperImpl() { - super("supplychain.shipper.Shipper", "customer"); - } - - - public void processShipment(String order) { - customer.notifyShipment(order + ", shipped"); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java deleted file mode 100644 index 2514928c10..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/shipper/Shipper.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.shipper; - -/** - * This is the business interface of the Shipper service component. - */ -public interface Shipper { - - public void processShipment(String order); - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java deleted file mode 100644 index 3c0bc6aa83..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/JavaWarehouseComponentImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.warehouse; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component (POJO implementation). - */ -@Service(Warehouse.class) -@Scope("STATELESS") -public class JavaWarehouseComponentImpl implements Warehouse { - - private Shipper shipper; - - - @Reference - public void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - public void fulfillOrder(String order) { - shipper.processShipment(order + ", fulfilled"); - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java deleted file mode 100644 index 600f3f0c74..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseComponentImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.warehouse; - -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service component (OSGi declarative services implementation). - */ - -public class OSGiWarehouseComponentImpl implements Warehouse { - - private Shipper shipper; - - - protected void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - protected void unsetShipper(Shipper shipper) { - this.shipper = null; - } - - public void fulfillOrder(String order) { - shipper.processShipment(order + ", fulfilled"); - - } - - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java deleted file mode 100644 index b8bca97bd0..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/OSGiWarehouseImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.warehouse; - - -import supplychain.OSGiBundleImpl; -import supplychain.shipper.Shipper; - -/** - * This class implements the Warehouse service componentm (OSGi procedural services implementation). - */ - -public class OSGiWarehouseImpl extends OSGiBundleImpl implements Warehouse { - - private Shipper shipper; - - public OSGiWarehouseImpl() { - super("supplychain.warehouse.Warehouse", "shipper"); - } - - - public void fulfillOrder(String order) { - shipper.processShipment(order + ", fulfilled"); - - } - - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java b/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java deleted file mode 100644 index 6f1f6b8730..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/java/supplychain/warehouse/Warehouse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain.warehouse; - -/** - * This is the business interface of the Warehouse service component. - */ -public interface Warehouse { - - public void fulfillOrder(String order); - -} diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/Customer.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/Customer.componentType deleted file mode 100644 index 5c61a0961c..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/Customer.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType deleted file mode 100644 index 87a184d968..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/DSCustomer.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType deleted file mode 100644 index 872ab6601a..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/DSRetailer.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/DSShipper.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/DSShipper.componentType deleted file mode 100644 index 57fcbbc5d1..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/DSShipper.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType deleted file mode 100644 index 75fa8029f7..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/DSWarehouse.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/Retailer.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/Retailer.componentType deleted file mode 100644 index 15185f2bf9..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/Retailer.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/Shipper.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/Shipper.componentType deleted file mode 100644 index 675597d80b..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/Shipper.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/Warehouse.componentType b/java/sca/samples/osgi-supplychain/src/main/resources/Warehouse.componentType deleted file mode 100644 index 6e1ac3e5a9..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/Warehouse.componentType +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf deleted file mode 100644 index 88d79e5219..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Customer.mf +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Customer -Bundle-SymbolicName: supplychain.customer.Customer -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - supplychain.retailer -Export-Package: supplychain.customer -Bundle-Activator: supplychain.customer.OSGiCustomerImpl - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf deleted file mode 100644 index d95ef5d582..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Retailer.mf +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Retailer -Bundle-SymbolicName: supplychain.retailer.Retailer -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - supplychain.warehouse -Export-Package: supplychain.retailer -Bundle-Activator: supplychain.retailer.OSGiRetailerImpl diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf deleted file mode 100644 index de7ac7ec7a..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Shipper.mf +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Shipper -Bundle-SymbolicName: supplychain.shipper.Shipper -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - supplychain.customer -Export-Package: supplychain.shipper -Bundle-Activator: supplychain.shipper.OSGiShipperImpl diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf deleted file mode 100644 index 21241a6899..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/Warehouse.mf +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Warehouse -Bundle-SymbolicName: supplychain.warehouse.Warehouse -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - supplychain.shipper -Export-Package: supplychain.warehouse -Bundle-Activator: supplychain.warehouse.OSGiWarehouseImpl diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf deleted file mode 100644 index b5c5a862be..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.mf +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Customer -Bundle-SymbolicName: ds.supplychain.customer.Customer -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - org.osgi.service.component, supplychain.retailer -Export-Package: supplychain.customer -Service-Component: osgi/ds/Customer.xml diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml deleted file mode 100644 index 5b368afd5b..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Customer.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf deleted file mode 100644 index 47897d16ca..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.mf +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Retailer -Bundle-SymbolicName: ds.supplychain.retailer.Retailer -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - org.osgi.service.component, - supplychain.warehouse -Export-Package: supplychain.retailer -Service-Component: osgi/ds/Retailer.xml diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml deleted file mode 100644 index cae7fdfde2..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Retailer.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf deleted file mode 100644 index f5333c7caa..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.mf +++ /dev/null @@ -1,10 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Shipper -Bundle-SymbolicName: ds.supplychain.shipper.Shipper -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - org.osgi.service.component, supplychain.customer -Export-Package: supplychain.shipper -Service-Component: osgi/ds/Shipper.xml diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml deleted file mode 100644 index d894309b71..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Shipper.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf deleted file mode 100644 index 6166549e5a..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.mf +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: Warehouse -Bundle-SymbolicName: ds.supplychain.warehouse.Warehouse -Bundle-Version: 1.0.0 -Bundle-Localization: plugin -Import-Package: org.osgi.framework, - org.osgi.service.component, - supplychain.shipper -Export-Package: supplychain.warehouse -Service-Component: osgi/ds/Warehouse.xml diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml b/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml deleted file mode 100644 index fc86a76784..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/osgi/ds/Warehouse.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.composite b/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.composite deleted file mode 100644 index 0bbfed9176..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.composite +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite b/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite deleted file mode 100644 index d1e11168e2..0000000000 --- a/java/sca/samples/osgi-supplychain/src/main/resources/supplychain.ds.composite +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/java/sca/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java deleted file mode 100644 index ff15c0d9a2..0000000000 --- a/java/sca/samples/osgi-supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - - -import supplychain.customer.Customer; - -/** - * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component and - * invoke it. - */ -public class SupplyChainClientTestCase extends TestCase { - - private SCADomain scaDomain; - private Customer customer; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("supplychain.composite"); - customer = scaDomain.getService(Customer.class, "CustomerComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - - public void test() throws Exception { - - customer.purchaseGoods(); - - System.out.println("Sleeping ..."); - Thread.sleep(2000); - System.out.println("Test complete"); - - } - - -} diff --git a/java/sca/samples/photo-gallery/README b/java/sca/samples/photo-gallery/README deleted file mode 100644 index c66edea985..0000000000 --- a/java/sca/samples/photo-gallery/README +++ /dev/null @@ -1,28 +0,0 @@ -Photo-Gallery Sample -====================================== - -This is a sample store scenario that is used as a getting started guide -for Tuscany SCA. For detailed information, please see: - -http://tuscany.apache.org/getting-started-with-tuscany.html - -or - -http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as follows: - -cd store -ant compile - -and then, to run: - -ant run - -Once the store application is running use your browser to visit the following -URL: - -http://localhost:8080/gallery/ diff --git a/java/sca/samples/photo-gallery/build.xml b/java/sca/samples/photo-gallery/build.xml deleted file mode 100644 index 652afc3570..0000000000 --- a/java/sca/samples/photo-gallery/build.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/photo-gallery/photo-gallery.png b/java/sca/samples/photo-gallery/photo-gallery.png deleted file mode 100644 index da413edeee..0000000000 Binary files a/java/sca/samples/photo-gallery/photo-gallery.png and /dev/null differ diff --git a/java/sca/samples/photo-gallery/photo-gallery.svg b/java/sca/samples/photo-gallery/photo-gallery.svg deleted file mode 100644 index 74f8ecd36d..0000000000 --- a/java/sca/samples/photo-gallery/photo-gallery.svg +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - store - ufs - - ShoppingCart - - CurrencyConverter - - - - - - - - - - CurrenyCode HTTP JSONRPC Atom - - Catalog - - - - diff --git a/java/sca/samples/photo-gallery/pom.xml b/java/sca/samples/photo-gallery/pom.xml deleted file mode 100644 index b96a89f0fc..0000000000 --- a/java/sca/samples/photo-gallery/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../pom.xml - - sample-photo-gallery - Apache Tuscany SCA Getting Started Online Store Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-widget-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - org.apache.derby - derby - 10.2.1.6 - - - - org.slf4j - slf4j-api - 1.3.0 - - - - org.slf4j - slf4j-log4j12 - 1.3.0 - - - - org.slf4j - jcl104-over-slf4j - 1.3.0 - - - - javax.jcr - jcr - 1.0 - - - - org.apache.jackrabbit - jackrabbit-core - 1.4 - - - - org.apache.jackrabbit - jackrabbit-api - 1.4 - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGallery.java b/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGallery.java deleted file mode 100644 index 1007cd49b0..0000000000 --- a/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGallery.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class LaunchGallery { - public static void main(String[] args) throws Exception { - System.out.println("Starting ..."); - SCADomain scaDomain = SCADomain.newInstance("photo-gallery.composite"); - System.out.println("photo.gallery.composite ready for big business !!!"); - System.in.read(); - System.out.println("Stopping ..."); - scaDomain.close(); - System.out.println(); - } -} diff --git a/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java b/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java deleted file mode 100644 index d07dc63592..0000000000 --- a/java/sca/samples/photo-gallery/src/main/java/launch/LaunchGalleryJCR.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class LaunchGalleryJCR { - public static void main(String[] args) throws Exception { - System.out.println("Starting ..."); - SCADomain scaDomain = SCADomain.newInstance("photo-gallery-jcr.composite"); - System.out.println("photo.gallery.composite ready for big business !!!"); - System.in.read(); - System.out.println("Stopping ..."); - scaDomain.close(); - System.out.println(); - } -} diff --git a/java/sca/samples/photo-gallery/src/main/java/services/Album.java b/java/sca/samples/photo-gallery/src/main/java/services/Album.java deleted file mode 100644 index d614b6a504..0000000000 --- a/java/sca/samples/photo-gallery/src/main/java/services/Album.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Album { - - public String[] getPictures(); - -} diff --git a/java/sca/samples/photo-gallery/src/main/java/services/AlbumImpl.java b/java/sca/samples/photo-gallery/src/main/java/services/AlbumImpl.java deleted file mode 100644 index 3cdc56e641..0000000000 --- a/java/sca/samples/photo-gallery/src/main/java/services/AlbumImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.io.File; -import java.io.FilenameFilter; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; - -public class AlbumImpl implements Album { - private String gallery; - private String album; - private String location; - private List pictures = new ArrayList(); - - @Property - public void setGallery(String gallery) { - this.gallery = gallery; - this.location = null; - } - @Property - public void setAlbum(String album) { - this.album = album; - this.location = null; - } - - protected String getLocation() { - if (location == null) { - location = gallery + "/" + album + "/"; - } - return location; - - } - - @Init - public void init() { - try { - URL albumURL = this.getClass().getClassLoader().getResource(getLocation()); - if(albumURL != null) { - File album = new File(albumURL.toURI()); - if (album.isDirectory() && album.exists()) { - String[] listPictures = album.list(new ImageFilter(".jpg")); - for(String image : listPictures) { - image = getLocation() + image; - pictures.add(image); - } - } - } - } catch (Exception e) { - // FIXME: ignore for now - e.printStackTrace(); - } - } - - public String[] getPictures() { - String[] pictureArray = new String[pictures.size()]; - pictures.toArray(pictureArray); - return pictureArray; - } - - /** - * Inner fileFilter class - */ - private class ImageFilter implements FilenameFilter { - String afn; - ImageFilter(String afn) { this.afn = afn; } - public boolean accept(File dir, String name) { - // Strip path information: - String f = new File(name).getName(); - return f.indexOf(afn) != -1; - } - } ///:~ - -} diff --git a/java/sca/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java b/java/sca/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java deleted file mode 100644 index 8ede831ea0..0000000000 --- a/java/sca/samples/photo-gallery/src/main/java/services/jcr/AlbumImpl.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services.jcr; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import javax.jcr.Node; -import javax.jcr.NodeIterator; -import javax.jcr.Repository; -import javax.jcr.Session; -import javax.jcr.SimpleCredentials; - -import org.apache.jackrabbit.core.TransientRepository; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; - -import services.Album; - -public class AlbumImpl implements Album { - private String gallery; - private String album; - private String location; - private Repository repository=null; - private Session session=null; - - @Property - public void setGallery(String gallery) { - this.gallery = gallery; - this.location = null; - } - @Property - public void setAlbum(String album) { - this.album = album; - this.location = null; - } - - protected String getLocation() { - if (location == null) { - location = gallery + "/" + album + "/"; - } - return location; - - } - - @Init - public void init() { - try { - URL albumURL = this.getClass().getClassLoader().getResource(getLocation()); - if(albumURL != null) { - repository = new TransientRepository(); - session = repository.login( - new SimpleCredentials("username", "password".toCharArray())); - try { - File album = new File(albumURL.toURI()); - if (album.isDirectory() && album.exists()) { - String[] listPictures = album.list(new ImageFilter(".jpg")); - for(String image : listPictures) { - Node root=session.getRootNode(); - Node picNode=root.addNode(image); - InputStream inFile = getClass().getClassLoader().getResourceAsStream(getLocation()+image); - picNode.setProperty("image", inFile ); - picNode.setProperty("name", image); - picNode.setProperty("location", getLocation()+image); - //image = getLocation() + image; - //pictures.add(image); - } - } - - session.save(); - }catch (Exception e){ - // FIXME: ignore for now - e.printStackTrace(); - } - } - } catch (Exception e) { - // FIXME: ignore for now - e.printStackTrace(); - } - } - - public String[] getPictures() { - List pictures = new ArrayList(); - - try{ - Node root=session.getRootNode(); - NodeIterator nodes = root.getNodes(); - - while(nodes.hasNext()){ - Node node=nodes.nextNode(); - if(node.getPath().equals("/jcr:system")) continue; - - pictures.add(node.getProperty("location").getString()); - //System.out.println(node.getProperty("name").getString()); - //System.out.println(node.getPath()); - } - }catch (Exception e) { - // FIXME: ignore for now - e.printStackTrace(); - } - - String[] pictureArray = new String[pictures.size()]; - pictures.toArray(pictureArray); - removeNodes(); - return pictureArray; - } - - - public void removeNodes(){ - try{ - Node root=session.getRootNode(); - NodeIterator nodes = root.getNodes(); - while(nodes.hasNext()){ - Node node=nodes.nextNode(); - if(node.getPath().equals("/jcr:system")) continue; - else node.remove(); - } - session.save(); - }catch (Exception e) { - // FIXME: ignore for now - e.printStackTrace(); - } - - } - /** - * Inner fileFilter class - */ - private class ImageFilter implements FilenameFilter { - String afn; - ImageFilter(String afn) { this.afn = afn; } - public boolean accept(File dir, String name) { - // Strip path information: - String f = new File(name).getName(); - return f.indexOf(afn) != -1; - } - } ///:~ - -} diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery.html b/java/sca/samples/photo-gallery/src/main/resources/gallery.html deleted file mode 100644 index f6566e88ec..0000000000 --- a/java/sca/samples/photo-gallery/src/main/resources/gallery.html +++ /dev/null @@ -1,135 +0,0 @@ - - - -Photo Gallery - - - - - - - - - -
-

Apache Tuscany Photo Gallery

-
-
- - -
- - - - - -
- - - - - - - - -
-
- - - - - -
- -
- -
- - - diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg deleted file mode 100644 index 9437b321e2..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00368.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg deleted file mode 100644 index 07f37ec505..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00369.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg deleted file mode 100644 index 2193784271..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00370.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg deleted file mode 100644 index 1532ee2c1b..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00371.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg deleted file mode 100644 index 17ffd73aec..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00373.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg deleted file mode 100644 index 19e9ec37df..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00375.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg deleted file mode 100644 index 022416dbce..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00376.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg deleted file mode 100644 index c78a974714..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00377.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg deleted file mode 100644 index a98070925a..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00378.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg deleted file mode 100644 index dc83889116..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00379.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg b/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg deleted file mode 100644 index 0e33548135..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/gallery/boston/dsc00380.jpg and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/index.gif b/java/sca/samples/photo-gallery/src/main/resources/index.gif deleted file mode 100755 index 7599ac7686..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/index.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/index_on.gif b/java/sca/samples/photo-gallery/src/main/resources/index_on.gif deleted file mode 100755 index 153e9879d6..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/index_on.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/next.gif b/java/sca/samples/photo-gallery/src/main/resources/next.gif deleted file mode 100755 index 002eaf6951..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/next.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/next_disabled.gif b/java/sca/samples/photo-gallery/src/main/resources/next_disabled.gif deleted file mode 100755 index 38b1298453..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/next_disabled.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/next_on.gif b/java/sca/samples/photo-gallery/src/main/resources/next_on.gif deleted file mode 100755 index 4e5bb3e7ef..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/next_on.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite b/java/sca/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite deleted file mode 100644 index 23190de555..0000000000 --- a/java/sca/samples/photo-gallery/src/main/resources/photo-gallery-jcr.composite +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - gallery - boston - - - - - - - - - diff --git a/java/sca/samples/photo-gallery/src/main/resources/photo-gallery.composite b/java/sca/samples/photo-gallery/src/main/resources/photo-gallery.composite deleted file mode 100644 index 0bb3c4b4db..0000000000 --- a/java/sca/samples/photo-gallery/src/main/resources/photo-gallery.composite +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - gallery - boston - - - - - - - - - diff --git a/java/sca/samples/photo-gallery/src/main/resources/prev.gif b/java/sca/samples/photo-gallery/src/main/resources/prev.gif deleted file mode 100755 index 4eea10f1dc..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/prev.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/prev_disabled.gif b/java/sca/samples/photo-gallery/src/main/resources/prev_disabled.gif deleted file mode 100755 index 7e35f07076..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/prev_disabled.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/prev_on.gif b/java/sca/samples/photo-gallery/src/main/resources/prev_on.gif deleted file mode 100755 index 3ef9a776bb..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/prev_on.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/show_slide.gif b/java/sca/samples/photo-gallery/src/main/resources/show_slide.gif deleted file mode 100644 index a5b6a15c2b..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/show_slide.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/space.gif b/java/sca/samples/photo-gallery/src/main/resources/space.gif deleted file mode 100644 index 170fe82b65..0000000000 Binary files a/java/sca/samples/photo-gallery/src/main/resources/space.gif and /dev/null differ diff --git a/java/sca/samples/photo-gallery/src/main/resources/styles.css b/java/sca/samples/photo-gallery/src/main/resources/styles.css deleted file mode 100755 index d23d949858..0000000000 --- a/java/sca/samples/photo-gallery/src/main/resources/styles.css +++ /dev/null @@ -1,121 +0,0 @@ -body { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - color: #888888; - background-color: #000000; - margin-top: 0px; -} - -html { - scrollbar-face-color:#444444; - scrollbar-highlight-color:#000000; - scrollbar-3dlight-color:#000000; - scrollbar-darkshadow-color:#000000; - scrollbar-shadow-color:#000000; - scrollbar-arrow-color:#888888; - scrollbar-track-color:#000000; -} - -a:link { - text-decoration: none; - color: #AAAAAA; -} - -a:visited { - text-decoration: none; - color: #AAAAAA; -} - -a:hover { - text-decoration: none; - color: #FFFFFF; -} - -.current { - font-weight: bold; - color: #AAAAAA; - background-color: #666666; -} - -.cthumb { - background-color: #666666; - border: 0px; border-width: 0px; -} - -.thumb { - background-color: #333333; - border: 0px; border-width: 0px; -} - -.image { margin: 0px; border-width: 1px; border: 1px solid;} -a:link .image { border-color: #aaaaaa; color: #aaaaaa;} -a:visited .image { border-color: #666666; color: #666666;} -a:hover .image { border-color: #ffffff; color: #ffffff;} - -.slideImage { border-width: 0px; border: 0px solid; border-color: #ffffff;} -a:link .slideImage { border-color: #ffffff;} -a:visited .slideImage { border-color: #ffffff;} - -.title { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 14px; - font-weight: bold; - color: #000000; -} - -.title a:link { - text-decoration: none; - color: #000000; -} - -.title a:visited { - text-decoration: none; - color: #000000; -} - -.title a:hover { - text-decoration: none; - color: #ffffff; -} - -.infotable { - border: 1px solid #444444; - border-collapse: collapse; -} - -.infotable td { - border: 1px solid #444444; -} - -.infotable table td { - border: 0px; -} - -.dirname { - font-size: 12px; - font-weight: bold; - color: #AAAAAA; -} - -.comment { - color: #CCCCCC; - font-weight: bold; - font-size: 12px; -} - -.smalltxt { - color: #888888; - font-size: 11px; -} - -.xsmalltxt { - color: #888888; - font-size: 9px; -} - -.newlabel { - font-size: 8px; - font-weight: bold; - color: #EEEEEE; - background-color: #558800; -} \ No newline at end of file diff --git a/java/sca/samples/pom.xml b/java/sca/samples/pom.xml index 709df7f4d9..9ade7320c8 100644 --- a/java/sca/samples/pom.xml +++ b/java/sca/samples/pom.xml @@ -54,75 +54,5 @@ - - - old - - binding-echo - binding-echo-extension - binding-notification-broker - binding-notification-consumer - binding-notification-producer - calculator - calculator-corba-reference - calculator-corba-service - calculator-lean - calculator-distributed - calculator-implementation-policies - calculator-rmi-reference - calculator-rmi-service - calculator-script - calculator-webapp - calculator-ws-secure-webapp - calculator-ws-webapp - callback-ws-client - callback-ws-service - chat-webapp - customer-dojo - customer-dojo-webapp - databinding-echo - - domain-management - feed-aggregator - feed-aggregator-webapp - helloworld-bpel - helloworld-dojo-webapp - helloworld-jms-webapp - helloworld-jsonrpc-webapp - helloworld-reference-jms - helloworld-service-jms - helloworld-ws-service - helloworld-ws-service-jms - helloworld-ws-service-secure - helloworld-ws-reference - helloworld-ws-reference-lean - helloworld-ws-reference-jms - helloworld-ws-reference-secure - helloworld-ws-sdo - helloworld-ws-sdo-webapp - implementation-composite - implementation-crud - implementation-crud-extension - implementation-notification - implementation-pojo-extension - loanapplication - osgi-supplychain - photo-gallery - quote-xquery - simple-bigbank - simple-bigbank-spring - spring-bigbank-checkaccount - spring-bigbank-calculator - spring-bigbank-stockquote - simple-callback - simple-callback-ws - store - store-distributed - supplychain - web-resource - zipcode-jaxws - - - - + diff --git a/java/sca/samples/quote-xquery/README b/java/sca/samples/quote-xquery/README deleted file mode 100644 index cf8a4609a6..0000000000 --- a/java/sca/samples/quote-xquery/README +++ /dev/null @@ -1,450 +0,0 @@ -Quote Xquery Sample -=================== - - This sample covers the most important integration scenarios for the xquery - implementation type and its corresponding saxon data bindings. - -If you just want to run it to see what happens open two command prompts (one for the server -and the other for the client), navigate to this sample directory and do: - -Command Prompt 1: -ant -ant run-server - -Command Prompt 2: -ant run - -OR if you don't have ant, on Windows do - -In the directory samples\quote-xquery use the JDK 1.5 java command to run the class xquery.quote.XQueryQuoteClient - -Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteServer -Linux: java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-quote-xquery.jar xquery.quote.XQueryQuoteClient - -Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteServer -Windows: java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-quote-xquery.jar xquery.quote.XQueryQuoteClient - -Results ----------- -The sample when run should simply display on the standard output some startup messages followed by: - -The compilation: - -Buildfile: build.xml - -init: - -generate-sdo: - [java] >> Generating code - [java] >> Generating packages - [java] >> Generating package QuotePackageImpl - [java] >> Generating Java interface org.example.quote.QuoteFactory - [java] >> Generating /TargetProject/org/example/quote/QuoteFactory.java - [java] >> Examining old /TargetProject/org/example/quote/QuoteFactory.java - [java] >> Generating Java class org.example.quote.impl.QuoteFactoryImpl - [java] >> Generating /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java - [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteFactoryImpl.java - [java] >> Generating Quote - [java] >> Generating Java interface org.example.quote.Quote - [java] >> Generating /TargetProject/org/example/quote/Quote.java - [java] >> Examining old /TargetProject/org/example/quote/Quote.java - [java] >> Generating Java class org.example.quote.impl.QuoteImpl - [java] >> Generating /TargetProject/org/example/quote/impl/QuoteImpl.java - [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteImpl.java - [java] >> Generating Response - [java] >> Generating Java interface org.example.quote.QuoteResponse - [java] >> Generating /TargetProject/org/example/quote/QuoteResponse.java - [java] >> Examining old /TargetProject/org/example/quote/QuoteResponse.java - [java] >> Generating Java class org.example.quote.impl.QuoteResponseImpl - [java] >> Generating /TargetProject/org/example/quote/impl/QuoteResponseImpl.java - [java] >> Examining old /TargetProject/org/example/quote/impl/QuoteResponseImpl.java - [java] >> Generating code - [java] >> Generating packages - [java] >> Generating package AvailPackageImpl - [java] >> Generating Java interface org.example.avail.AvailFactory - [java] >> Generating /TargetProject/org/example/avail/AvailFactory.java - [java] >> Examining old /TargetProject/org/example/avail/AvailFactory.java - [java] >> Generating Java class org.example.avail.impl.AvailFactoryImpl - [java] >> Generating /TargetProject/org/example/avail/impl/AvailFactoryImpl.java - [java] >> Examining old /TargetProject/org/example/avail/impl/AvailFactoryImpl.java - [java] >> Generating Quote - [java] >> Generating Java interface org.example.avail.AvailQuote - [java] >> Generating /TargetProject/org/example/avail/AvailQuote.java - [java] >> Examining old /TargetProject/org/example/avail/AvailQuote.java - [java] >> Generating Java class org.example.avail.impl.AvailQuoteImpl - [java] >> Generating /TargetProject/org/example/avail/impl/AvailQuoteImpl.java - [java] >> Examining old /TargetProject/org/example/avail/impl/AvailQuoteImpl.java - [java] >> Generating Request - [java] >> Generating Java interface org.example.avail.AvailRequest - [java] >> Generating /TargetProject/org/example/avail/AvailRequest.java - [java] >> Examining old /TargetProject/org/example/avail/AvailRequest.java - [java] >> Generating Java class org.example.avail.impl.AvailRequestImpl - [java] >> Generating /TargetProject/org/example/avail/impl/AvailRequestImpl.java - [java] >> Examining old /TargetProject/org/example/avail/impl/AvailRequestImpl.java - [java] >> Generating code - [java] >> Generating packages - [java] >> Generating package PricePackageImpl - [java] >> Generating Java interface org.example.price.PriceFactory - [java] >> Generating /TargetProject/org/example/price/PriceFactory.java - [java] >> Examining old /TargetProject/org/example/price/PriceFactory.java - [java] >> Generating Java class org.example.price.impl.PriceFactoryImpl - [java] >> Generating /TargetProject/org/example/price/impl/PriceFactoryImpl.java - [java] >> Examining old /TargetProject/org/example/price/impl/PriceFactoryImpl.java - [java] >> Generating Quote - [java] >> Generating Java interface org.example.price.PriceQuote - [java] >> Generating /TargetProject/org/example/price/PriceQuote.java - [java] >> Examining old /TargetProject/org/example/price/PriceQuote.java - [java] >> Generating Java class org.example.price.impl.PriceQuoteImpl - [java] >> Generating /TargetProject/org/example/price/impl/PriceQuoteImpl.java - [java] >> Examining old /TargetProject/org/example/price/impl/PriceQuoteImpl.java - [java] >> Generating Request - [java] >> Generating Java interface org.example.price.PriceRequest - [java] >> Generating /TargetProject/org/example/price/PriceRequest.java - [java] >> Examining old /TargetProject/org/example/price/PriceRequest.java - [java] >> Generating Java class org.example.price.impl.PriceRequestImpl - [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestImpl.java - [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestImpl.java - [java] >> Generating Requests - [java] >> Generating Java interface org.example.price.PriceRequests - [java] >> Generating /TargetProject/org/example/price/PriceRequests.java - [java] >> Examining old /TargetProject/org/example/price/PriceRequests.java - [java] >> Generating Java class org.example.price.impl.PriceRequestsImpl - [java] >> Generating /TargetProject/org/example/price/impl/PriceRequestsImpl.java - [java] >> Examining old /TargetProject/org/example/price/impl/PriceRequestsImpl.java - [java] >> Generating Ship Address - [java] >> Generating Java interface org.example.price.ShipAddress - [java] >> Generating /TargetProject/org/example/price/ShipAddress.java - [java] >> Examining old /TargetProject/org/example/price/ShipAddress.java - [java] >> Generating Java class org.example.price.impl.ShipAddressImpl - [java] >> Generating /TargetProject/org/example/price/impl/ShipAddressImpl.java - [java] >> Examining old /TargetProject/org/example/price/impl/ShipAddressImpl.java - -compile: - [jar] Building jar: C:\Apache\tuscany-sca-1.0-incubating-SNAPSHOT\samples\quote-xquery\target\sample-quote-xquery.jar -BUILD SUCCESSFUL - - -The service side: - -run-server: - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.core.StandardEngine start - [java] INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.ContextConfig defaultWebConfig - [java] INFO: No default web.xml - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_1.dtd - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_2.dtd - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register - [java] WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_0.xsd - [java] Sep 18, 2007 1:14:16 PM org.apache.catalina.startup.DigesterFactory register - [java] WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xsd - [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol init - [java] INFO: Initializing Coyote HTTP/1.1 on http-8085 - [java] Sep 18, 2007 1:14:17 PM org.apache.coyote.http11.Http11Protocol start - [java] INFO: Starting Coyote HTTP/1.1 on http-8085 - [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8085/QuoteJoinService - [java] Sep 18, 2007 1:14:17 PM org.apache.tuscany.sca.http.tomcat.TomcatServer addServletMapping - [java] INFO: Added Servlet mapping: http://localhost:8085/AvailQuoteProviderService - [java] XQuery Quote server started (press enter to shutdown) - [java] Sep 18, 2007 1:16:54 PM org.apache.coyote.http11.Http11Protocol destroy - [java] INFO: Stopping Coyote HTTP/1.1 on http-8085 - -BUILD SUCCESSFUL -Total time: 2 minutes 51 seconds - -The client side: -Buildfile: build.xml - -run: - [java] Input quote for the price list: - [java] - [java] - [java] Acme Inc - [java] - [java] - [java] - [java] 12 - [java] 1.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] - [java] - [java] 211 - [java] 10.0 - [java] - [java] - [java] - [java] - [java] Input quote for the availability: - [java] - [java] - [java] - [java] 12 - [java] 10 - [java] true - [java] 2003-03-22 - [java] - [java] - [java] 134 - [java] 345 - [java] false - [java] BackOrder - [java] - [java] - [java] 211 - [java] 100 - [java] true - [java] 2003-04-21 - [java] - [java] - [java] - [java] - [java] Output quote from local join: - [java] - [java] - [java] Acme Inc - [java]
12 Springs Rd,Morris Plains,NJ,07960
- [java] - [java] 12 - [java] 1.0 - [java] 10 - [java] true - [java] 2003-03-22 - [java] 0.1 - [java] 11.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] 345 - [java] false - [java] BackOrder - [java] 0.1 - [java] 0.0 - [java] - [java] - [java] 211 - [java] 10.0 - [java] 100 - [java] true - [java] 2003-04-21 - [java] 0.1 - [java] 1100.0 - [java] - [java]
- [java] - [java] - [java] Output quote from local join (second invokation): - [java] - [java] - [java] Acme Inc - [java]
12 Springs Rd,Morris Plains,NJ,07960
- [java] - [java] 12 - [java] 1.0 - [java] 10 - [java] true - [java] 2003-03-22 - [java] 0.2 - [java] 12.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] 345 - [java] false - [java] BackOrder - [java] 0.2 - [java] 0.0 - [java] - [java] - [java] 211 - [java] 10.0 - [java] 100 - [java] true - [java] 2003-04-21 - [java] 0.2 - [java] 1200.0 - [java] - [java]
- [java] - [java] - [java] Output quote from web service join: - [java] - [java] - [java] Acme Inc - [java]
12 Springs Rd,Morris Plains,NJ,07960
- [java] - [java] 12 - [java] 1.0 - [java] 10 - [java] true - [java] 2003-03-22 - [java] 0.1 - [java] 11.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] 345 - [java] false - [java] BackOrder - [java] 0.1 - [java] 0.0 - [java] - [java] - [java] 211 - [java] 10.0 - [java] 100 - [java] true - [java] 2003-04-21 - [java] 0.1 - [java] 1100.0 - [java] - [java]
- [java] - [java] - [java] Output quote from properties join: - [java] - [java] - [java] Acme Inc - [java]
12 Springs Rd,Morris Plains,NJ,07960
- [java] - [java] 12 - [java] 1.0 - [java] 10 - [java] true - [java] 2003-03-22 - [java] 0.1 - [java] 11.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] 345 - [java] false - [java] BackOrder - [java] 0.1 - [java] 0.0 - [java] - [java] - [java] 211 - [java] 10.0 - [java] 100 - [java] true - [java] 2003-04-21 - [java] 0.1 - [java] 1100.0 - [java] - [java]
- [java] - [java] - [java] Output quote from external references join: - [java] - [java] - [java] Acme Inc - [java]
12 Springs Rd,Morris Plains,NJ,07960
- [java] - [java] 12 - [java] 1.0 - [java] 10 - [java] true - [java] 2003-03-22 - [java] 0.1 - [java] 11.0 - [java] - [java] - [java] 134 - [java] 34.1 - [java] 345 - [java] false - [java] BackOrder - [java] 0.1 - [java] 0.0 - [java] - [java] - [java] 211 - [java] 10.0 - [java] 100 - [java] true - [java] 2003-04-21 - [java] 0.1 - [java] 1100.0 - [java] - [java]
- [java] - -BUILD SUCCESSFUL -Total time: 16 seconds - - - -Sample Overview ---------------- - - 1. There is a central component for invoking the different - scenarios: QuoteJoinLocalComponent - 2. It provides the following cases: - - invoke XQuery component in the current assembly, by providing all needed - information as input parameters - - invoke XQuery component in external assembly, which is exposed as a web - service - - invoke XQuery component in the current assembly, which retrieves the needed - information from the component properties - - invoke XQuery component in the current assembly, which retrieves the needed - information from its references to other components: - - one of the components is in the current assembly - - the other component is in anther assembly and it is exposed (and accessed) - as web service - - 3. All of the XQuery components have reference to a component for calculation of the - total price - 4. SDO is used for data interchange - -src/main/resources - wsdl - AvailQuote.xsd - PriceQuote.xsd - Quote.xsd - quotejoin.wsdl - META-INF - sca - quote_join_external_references.xq --- the external references xquery script - quote_join_properties.xq --- the property-based join xquery script - quote_join.xq --- the join xquery script - xqueryquotews.composite --- composite file for the client side - xqueryquotewsclient.composite --- composite file for the service side - - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -cd quote-xquery -ant compile -ant run-server - -you should see: -Buildfile: build.xml - -run: - - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd quote-xquery -mvn - - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/quote-xquery/build.xml b/java/sca/samples/quote-xquery/build.xml deleted file mode 100644 index a3a5acf102..0000000000 --- a/java/sca/samples/quote-xquery/build.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/pom.xml b/java/sca/samples/quote-xquery/pom.xml deleted file mode 100644 index 2fa134132c..0000000000 --- a/java/sca/samples/quote-xquery/pom.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-quote-xquery - Apache Tuscany SCA XQuery Quote Implementation Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-xquery - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sdo - tuscany-sdo-lib - 1.1.1 - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1.1 - - - - - - net.sf.saxon - saxon - 8.7 - - - - org.apache.tuscany.sca - tuscany-databinding-sdo - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - compile - - - - - - ${artifactId} - - - org.codehaus.mojo - build-helper-maven-plugin - 1.0 - - - add-source - generate-sources - - add-test-source - - - - target/sdo-source - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1.1 - - - generate-quotejoin-sdo - generate-sources - - ${basedir}/src/main/resources/wsdl/quotejoin.wsdl - - - generate - - - - generate-quote-sdo - generate-sources - - ${basedir}/src/main/resources/wsdl/Quote.xsd - - - generate - - - - generate-avail-quote-sdo - generate-sources - - ${basedir}/src/main/resources/wsdl/AvailQuote.xsd - - - generate - - - - generate-price-quote-sdo - generate-sources - - ${basedir}/src/main/resources/wsdl/PriceQuote.xsd - - - generate - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java deleted file mode 100644 index 81396b056a..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.avail.AvailQuote; -import org.oasisopen.sca.annotation.Service; - -@Service(AvailQuoteProviderService.class) -public class AvailQuoteProviderImpl implements AvailQuoteProviderService { - - public AvailQuote provideAvailQuote(String dummyString) { - return QuoteDataUtil.buildAvailQuoteData(); - } -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java deleted file mode 100644 index fb097c46f8..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import net.sf.saxon.om.NodeInfo; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface AvailQuoteProviderNodeInfo { - NodeInfo provideAvailQuote(String dummyString); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java deleted file mode 100644 index c54febcd14..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.avail.AvailQuote; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface AvailQuoteProviderService { - AvailQuote provideAvailQuote(String dummyString); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java deleted file mode 100644 index ebe0cd51ae..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.quote.Quote; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface ExternalReferencesQuoteJoin { - public Quote joinPriceAndAvailQuotes(float taxRate); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java deleted file mode 100644 index 92341ea26f..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.price.PriceQuote; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface PriceQuoteProvider { - - public PriceQuote providePriceQuote(); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java deleted file mode 100644 index d2d175430b..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.price.PriceQuote; - -public class PriceQuoteProviderImpl implements PriceQuoteProvider { - public PriceQuote providePriceQuote() { - return QuoteDataUtil.buildPriceQuoteData(); - } -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java deleted file mode 100644 index 5669738c98..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import net.sf.saxon.om.NodeInfo; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface PriceQuoteProviderNodeInfo { - public NodeInfo providePriceQuote(); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java deleted file mode 100644 index 1a71abab81..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - -import org.example.quote.Quote; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface PropertiesQuoteJoin { - @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes") - @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse") - public Quote joinPriceAndAvailQuotes(); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java deleted file mode 100644 index 5aea04bfb1..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface QuoteCalculator { - public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java deleted file mode 100644 index 26331381a8..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -public class QuoteCalculatorImpl implements QuoteCalculator { - - public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder) { - float totalTax, costNoTax, totalCost; - if (fillOrder) { - // Calculate the total tax - totalTax = taxRate * quantity * price; - // Calculate the total cost without tax - costNoTax = quantity * price; - // Add the tax and the cost to get the total cost - totalCost = totalTax + costNoTax; - } else { - totalCost = 0; - } - return totalCost; - } - -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java deleted file mode 100644 index 8ed02dc1ef..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteDataUtil.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import java.io.IOException; -import java.math.BigInteger; - - -import org.example.avail.AvailFactory; -import org.example.avail.AvailQuote; -import org.example.avail.AvailRequest; -import org.example.price.PriceFactory; -import org.example.price.PriceQuote; -import org.example.price.PriceRequest; -import org.example.price.PriceRequests; -import org.example.price.ShipAddress; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.XMLHelper; - -public class QuoteDataUtil { - - public static AvailQuote buildAvailQuoteData() { - AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote(); - AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(12)); - availRequest.setRequestedQuantity(10); - availRequest.setQuantityAvail(true); - availRequest.setShipDate("2003-03-22"); - availQuote.getAvailRequest().add(availRequest); - - availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(134)); - availRequest.setRequestedQuantity(345); - availRequest.setQuantityAvail(false); - availRequest.setShipDate("BackOrder"); - availQuote.getAvailRequest().add(availRequest); - - availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(211)); - availRequest.setRequestedQuantity(100); - availRequest.setQuantityAvail(true); - availRequest.setShipDate("2003-04-21"); - availQuote.getAvailRequest().add(availRequest); - - return availQuote; - } - - public static PriceQuote buildPriceQuoteData() { - PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote(); - priceQuote.setCustomerName("Acme Inc"); - - ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress(); - shipAddress.setStreet("12 Springs Rd"); - shipAddress.setCity("Morris Plains"); - shipAddress.setState("nj"); - shipAddress.setZip("07960"); - priceQuote.setShipAddress(shipAddress); - - PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests(); - PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(12)); - priceRequest.setPrice(1.00f); - priceRequests.getPriceRequest().add(priceRequest); - - priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(134)); - priceRequest.setPrice(34.10f); - priceRequests.getPriceRequest().add(priceRequest); - - priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(211)); - priceRequest.setPrice(10.00f); - priceRequests.getPriceRequest().add(priceRequest); - - priceQuote.setPriceRequests(priceRequests); - - return priceQuote; - } - - public static void serializeToSystemOut(DataObject object, String name) { - XMLHelper helper = XMLHelper.INSTANCE; - - try { - helper.save(object, null, name, System.out); - System.out.println(); - } catch (IOException e) { - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java deleted file mode 100644 index 103d19e59d..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface QuoteJoin { - @RequestWrapper(className="xquery.quote.joinPriceAndAvailQuotes") - @ResponseWrapper(className="xquery.quote.joinPriceAndAvailQuotesResponse") - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java deleted file mode 100644 index cfd201f883..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; - -public interface QuoteJoinLocal { - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); - - public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); - - public Quote joinPriceAndAvailQuotes(); - - public Quote joinPriceAndAvailQuotes(float taxRate); - -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java deleted file mode 100644 index 26bcfe9707..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; -import org.oasisopen.sca.annotation.Reference; - -public class QuoteJoinLocalImpl implements QuoteJoinLocal { - private QuoteJoin quoteJoin; - private QuoteJoin quoteJoinWs; - private PropertiesQuoteJoin propertiesQuoteJoin; - private ExternalReferencesQuoteJoin externalServicesQuoteJoin; - - @Reference - public void setQuoteJoin(QuoteJoin quoteJoin) { - this.quoteJoin = quoteJoin; - } - - @Reference - public void setQuoteJoinWs(QuoteJoin quoteJoinWs) { - this.quoteJoinWs = quoteJoinWs; - } - - @Reference - public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) { - this.propertiesQuoteJoin = propertiesQuoteJoin; - } - - @Reference - public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) { - this.externalServicesQuoteJoin = externalServicesQuoteJoin; - } - - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { - return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); - } - - public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { - return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); - } - - public Quote joinPriceAndAvailQuotes(float taxRate) { - return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate); - } - - public Quote joinPriceAndAvailQuotes() { - return propertiesQuoteJoin.joinPriceAndAvailQuotes(); - } -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java deleted file mode 100644 index adc852acd4..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteClient.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; - -import commonj.sdo.DataObject; - -/** - * Integration test for the XQuery implementation type - * @version $Rev: 577067 $ $Date: 2007-09-18 22:10:03 +0100 (Tue, 18 Sep 2007) $ - * This test covers the most important integration scenarios for the xquery - * implementation type and its corresponding saxon data bindings: - * - * 1. There is a central component for invoking the different - * scenarios: QuoteJoinLocalComponent - * 2. It provides the following tests: - * - invoke XQuery component in the current assembly, by providing all needed - * information as input parameters - * - invoke XQuery component in external assembly, which is exposed as a web - * service - * - invoke XQuery component in the current assembly, which retrieves the needed - * information from the component properties - * - invoke XQuery component in the current assembly, which retrieves the needed - * information from its references to other components: - * - one of the components is in the current assembly - * - the other component is in anther assembly and it is exposed (and accessed) - * as web service - * - * 3. All of the XQuery components have reference to a component for calculation of the - * total price - * 4. SDO is used for data interchange - */ -public class XQueryQuoteClient { - - public static boolean SHOW_DEBUG_MSG = false; - - private SCADomain scaDomain; - - private QuoteJoinLocal quoteJoinLocal; - - public void startClient() throws Exception { - try { - scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite"); - quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent"); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - public void testQuoteJoin() { - AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData(); - PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData(); - - if (SHOW_DEBUG_MSG) { - System.out.println("Input quote for the price list:"); - QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote"); - System.out.println(); - System.out.println("Input quote for the availability:"); - QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote"); - System.out.println(); - } - - Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from local join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from local join (second invokation):"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.2f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from web service join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from properties join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from external references join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - // TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f); - } - - public void stopClient() throws Exception { - if (scaDomain != null) { - scaDomain.close(); - } - } - - public static void main(String[] args) throws Exception { - SHOW_DEBUG_MSG = true; - XQueryQuoteClient client = new XQueryQuoteClient(); - client.startClient(); - try { - client.testQuoteJoin(); - } finally { - client.stopClient(); - } - } -} diff --git a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java b/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java deleted file mode 100644 index 3fa3cdb637..0000000000 --- a/java/sca/samples/quote-xquery/src/main/java/xquery/quote/XQueryQuoteServer.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class XQueryQuoteServer { - - public static void main(String[] args) { - SCADomain scaDomain = SCADomain.newInstance("xqueryquotews.composite"); - try { - System.out.println("XQuery Quote server is started (press enter to shutdown)."); - System.in.read(); - System.out.println("XQuery Quote server is stopping..."); - } catch (IOException e) { - e.printStackTrace(); - } - scaDomain.close(); - System.out.println("XQuery Quote server is now stopped."); - } -} diff --git a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq b/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq deleted file mode 100644 index d504f40f04..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq +++ /dev/null @@ -1,61 +0,0 @@ -(: - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -:) - -declare namespace quoteJoin="scaservice:java/xquery.quote.QuoteJoin"; - -declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; - -declare namespace quo="http://www.example.org/quote"; - -declare variable $quoteCalculator external; - -declare function quoteJoin:joinPriceAndAvailQuotes($priceQuoteDoc, $availQuoteDoc, $taxRate) { - - { data($priceQuoteDoc/*/customerName) } - { concat($priceQuoteDoc/*/shipAddress/@street , ",", $priceQuoteDoc/*/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/*/shipAddress/@state) , ",", $priceQuoteDoc/*/shipAddress/@zip) } - { - for $priceRequest in $priceQuoteDoc/*/priceRequests/priceRequest, - $availRequest in $availQuoteDoc/*/availRequest - where data($priceRequest/widgetId) = data($availRequest/widgetId) - return - - { data($priceRequest/widgetId) } - { data($priceRequest/price) } - { data($availRequest/requestedQuantity) } - { data($availRequest/quantityAvail) } - { - for $shipDate in $availRequest/shipDate - return - { data($shipDate) } - } - { $taxRate } - { quoteCalculator:calculateTotalPrice( - $quoteCalculator, - - xs:float($taxRate), - - $availRequest/requestedQuantity, - - $priceRequest/price, - - $availRequest/quantityAvail) } - - } - -}; diff --git a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq b/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq deleted file mode 100644 index cc50da164a..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq +++ /dev/null @@ -1,69 +0,0 @@ -(: - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -:) -declare namespace quoteJoin="scaservice:java/xquery.quote.ExternalReferencesQuoteJoin"; - -declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; - -declare namespace priceQuoteProvider="scareference:java/xquery.quote.PriceQuoteProviderNodeInfo"; -declare namespace availQuoteProvider="scareference:java/xquery.quote.AvailQuoteProviderNodeInfo"; - -declare namespace quo="http://www.example.org/quote"; - -declare variable $quoteCalculator external; - -declare variable $priceQuoteProvider external; -declare variable $availQuoteProvider external; - -declare function quoteJoin:joinPriceAndAvailQuotes($taxRate) { -let $priceQuoteDoc := priceQuoteProvider:providePriceQuote($priceQuoteProvider) -let $availQuoteDoc := availQuoteProvider:provideAvailQuote($availQuoteProvider, 'dummy') -return - - { data($priceQuoteDoc/priceQuote/customerName) } - { concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) } - { - for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest, - $availRequest in $availQuoteDoc/availQuote/availRequest - where data($priceRequest/widgetId) = data($availRequest/widgetId) - return - - { data($priceRequest/widgetId) } - { data($priceRequest/price) } - { data($availRequest/requestedQuantity) } - { data($availRequest/quantityAvail) } - { - for $shipDate in $availRequest/shipDate - return - { data($shipDate) } - } - { $taxRate } - { quoteCalculator:calculateTotalPrice( - $quoteCalculator, - - $taxRate, - - $availRequest/requestedQuantity, - - $priceRequest/price, - - $availRequest/quantityAvail) } - - } - -}; diff --git a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq deleted file mode 100644 index cf41ab528d..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq +++ /dev/null @@ -1,74 +0,0 @@ -(: - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -:) - -declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin"; - -declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator"; - -declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote"; -declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote"; -declare namespace taxRate="scaproperty:java/java.lang.Float"; - -declare namespace pri="http://www.example.org/price"; -declare namespace ava="http://www.example.org/avail"; -declare namespace quo="http://www.example.org/quote"; - -declare variable $quoteCalculator external; - -declare variable $priceQuoteDoc external; -declare variable $availQuoteDoc external; -declare variable $taxRate external; - -declare function quoteJoin:joinPriceAndAvailQuotes() { - - { data($priceQuoteDoc/pri:priceQuote/customerName) } - { concat($priceQuoteDoc/pri:priceQuote/shipAddress/@street , ",", - $priceQuoteDoc/pri:priceQuote/shipAddress/@city ,",", - fn:upper-case($priceQuoteDoc/pri:priceQuote/shipAddress/@state) , ",", - $priceQuoteDoc/pri:priceQuote/shipAddress/@zip) } - { - for $priceRequest in $priceQuoteDoc/pri:priceQuote/priceRequests/priceRequest, - $availRequest in $availQuoteDoc/ava:availQuote/availRequest - where data($priceRequest/widgetId) = data($availRequest/widgetId) - return - - { data($priceRequest/widgetId) } - { data($priceRequest/price) } - { data($availRequest/requestedQuantity) } - { data($availRequest/quantityAvail) } - { - for $shipDate in $availRequest/shipDate - return - { data($shipDate) } - } - { $taxRate } - { quoteCalculator:calculateTotalPrice( - $quoteCalculator, - - $taxRate, - - $availRequest/requestedQuantity, - - $priceRequest/price, - - $availRequest/quantityAvail) } - - } - -}; diff --git a/java/sca/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd b/java/sca/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd deleted file mode 100644 index e7f3e67068..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd b/java/sca/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd deleted file mode 100644 index 4c437586ef..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd b/java/sca/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd deleted file mode 100644 index 4f64850056..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl b/java/sca/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl deleted file mode 100644 index 96c2af138a..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/resources/xqueryquotews.composite b/java/sca/samples/quote-xquery/src/main/resources/xqueryquotews.composite deleted file mode 100644 index 9e35e2ecb2..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/xqueryquotews.composite +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/java/sca/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite deleted file mode 100644 index 35306b9f89..0000000000 --- a/java/sca/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - Acme Inc - - - - 12 - 1.0 - - - 134 - 34.1 - - - 211 - 10.0 - - - - - - - - - - 12 - 10 - true - 2003-03-22 - - - 134 - 345 - false - BackOrder - - - 211 - 100 - true - 2003-04-21 - - - - 0.1 - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java deleted file mode 100644 index 9555532b3e..0000000000 --- a/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import java.util.List; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner; -import org.example.avail.AvailQuote; -import org.example.avail.AvailRequest; -import org.example.price.PriceQuote; -import org.example.price.PriceRequest; -import org.example.price.ShipAddress; -import org.example.quote.Quote; -import org.example.quote.QuoteResponse; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import commonj.sdo.DataObject; - -/** - * Integration test for the XQuery implementation type - * @version $Rev$ $Date$ - * This test covers the most important integration scenarios for the xquery - * implementation type and its corresponding saxon data bindings: - * - * 1. There is a central component for invoking the different - * scenarios: QuoteJoinLocalComponent - * 2. It provides the following tests: - * - invoke XQuery component in the current assembly, by providing all needed - * information as input parameters - * - invoke XQuery component in external assembly, which is exposed as a web - * service - * - invoke XQuery component in the current assembly, which retrieves the needed - * information from the component properties - * - invoke XQuery component in the current assembly, which retrieves the needed - * information from its references to other components: - * - one of the components is in the current assembly - * - the other component is in anther assembly and it is exposed (and accessed) - * as web service - * - * 3. All of the XQuery components have reference to a component for calculation of the - * total price - * 4. SDO is used for data interchange - */ -public class XQueryQuoteClientTestCase { - - public static boolean SHOW_DEBUG_MSG = false; - - private SCADomain scaDomain; - private SCATestCaseRunner server; - - private QuoteJoinLocal quoteJoinLocal; - - @Before - public void startClient() throws Exception { - try { - scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite"); - - quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent"); - - server = new SCATestCaseRunner(XQueryQuoteTestServer.class); - server.before(); - } catch (Throwable t) { - t.printStackTrace(); - } - } - - @Test - public void testQuoteJoin() { - AvailQuote availQuote = QuoteDataUtil.buildAvailQuoteData(); - PriceQuote priceQuote = QuoteDataUtil.buildPriceQuoteData(); - - if (SHOW_DEBUG_MSG) { - System.out.println("Input quote for the price list:"); - QuoteDataUtil.serializeToSystemOut((DataObject)priceQuote, "priceQuote"); - System.out.println(); - System.out.println("Input quote for the availability:"); - QuoteDataUtil.serializeToSystemOut((DataObject)availQuote, "availQuote"); - System.out.println(); - } - - Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from local join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from local join (second invokation):"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.2f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from web service join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from properties join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); - - quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f); - if (SHOW_DEBUG_MSG) { - System.out.println(); - System.out.println("Output quote from external references join:"); - QuoteDataUtil.serializeToSystemOut((DataObject)quote, "quote"); - System.out.println(); - } - XQueryQuoteClientTestCase.assertQuote(availQuote, priceQuote, quote, 0.1f); - } - - @After - public void stopClient() throws Exception { - server.after(); - scaDomain.close(); - } - - public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) { - QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl(); - - TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName()); - ShipAddress shipAddress = priceQuote.getShipAddress(); - TestCase.assertEquals(shipAddress.getStreet() + "," - + shipAddress.getCity() - + "," - + shipAddress.getState().toUpperCase() - + "," - + shipAddress.getZip(), quote.getAddress()); - List availRequests = availQuote.getAvailRequest(); - List priceRequests = priceQuote.getPriceRequests().getPriceRequest(); - List quoteResponses = quote.getQuoteResponse(); - TestCase.assertEquals(availRequests.size(), priceRequests.size()); - TestCase.assertEquals(availRequests.size(), quoteResponses.size()); - - for (int i = 0; i < availRequests.size(); i++) { - AvailRequest availRequest = (AvailRequest)availRequests.get(i); - PriceRequest priceRequest = (PriceRequest)priceRequests.get(i); - QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i); - TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId()); - TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice()); - TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity()); - TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder()); - if (availRequest.getShipDate() == null) { - TestCase.assertNull(quoteResponse.getShipDate()); - } else { - TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate()); - } - TestCase.assertEquals(taxRate, quoteResponse.getTaxRate()); - TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate, - availRequest.getRequestedQuantity(), - priceRequest.getPrice(), - availRequest.isQuantityAvail()), - quoteResponse.getTotalCost()); - } - } -} diff --git a/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java b/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java deleted file mode 100644 index 9a4be5bda6..0000000000 --- a/java/sca/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package xquery.quote; - -import java.io.IOException; -import java.net.Socket; - -import org.apache.tuscany.sca.host.embedded.SCADomain; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class XQueryQuoteTestServer { - private SCADomain scaDomain; - - @Before - public void startServer() throws Exception { - try { - scaDomain = SCADomain.newInstance("xqueryquotews.composite"); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Test - public void testPing() throws IOException { - new Socket("127.0.0.1", 8085); - } - - @After - public void stopServer() throws Exception { - scaDomain.close(); - } -} diff --git a/java/sca/samples/simple-bigbank-spring/README b/java/sca/samples/simple-bigbank-spring/README deleted file mode 100644 index bb44d63719..0000000000 --- a/java/sca/samples/simple-bigbank-spring/README +++ /dev/null @@ -1,148 +0,0 @@ -Spring Bigbank Sample -====================== -This sample is made of 3 modules that represent the different aspects of a fictitious banking application. - -To run the simple-bigbank-spring sample you need to first run spring-bigbank-calculator, spring-bigbank-checkaccount and spring-bigbank-stockquote composites. -This will bring up Tuscany runtime and load the three applications and make them available as services. -Bigbank-Spring is dependent on these services. - -This demo uses ant. This is just one way of running this demo. - -Start Spring-Bigbank-calculator Composite ------------------------------------------ - -Spring-Bigbank-calculator is a calculator application which handles add, subtract, multiply and divide operations. Each of these operations is implemented in a different language, including JavaScript, groovy, Ruby and Python. - -To run the spring-bigbank-calculator composite and make it available as a service for this demo do the following: - -cd spring-bigbank-calculator -ant compile -ant run - -.. Leave the server running - -Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on. - -Start Spring-Bigbank-checkaccount Composite -------------------------------------------- - -This contains all artifacts that deal with the account management within the bigbank. The services offered by the bigbank-account module are used by the bigbank. - -cd spring-bigbank-checkaccount -ant compile -ant run - -.. Leave the server running - -Note that 'ant compile' needs to be done the first time you run this demo out of the binary distribution. No need to do 'ant compile' from there on. - -Start Spring-Bigbank-stockquote Composite ------------------------------------------ - -A very simple web services based stock quote application which returns random -stock quotes on request. Please note that the stockquote service is not live and is implemented instead to allow for this application to always run without dependency on the availability of a webservice. - -cd spring-bigbank-stockquote -ant compile -ant run - -.. Leave the server running - -Start Spring Bigbank --------------------- -This contains all artifacts that make up the bigbank application. This is the application that the end user interacts with - -Start spring-bigbank in the following way: - -i ) Compile the spring-bigbank as follows : - - cd simple-bigbank-spring - ant compile - -ii) Now start the bigbank service as follows : - - cd bigbank - ant compile - ant run - - .. Leave the server running - -Note that 'ant compile' needs to be done the first time you run this demo out ofthe binary distribution. -No need to do 'ant compile' from there on. - -Sample Overview ---------------- -This sample demonstrates a simple bank summary transaction using Spring for one of the components. - -A request to the AccountComponent results in a request to the AccountDataComponent to get account data -which is based on a random stock quote price. Therefore result for this sample will vary on each run. - - -simple-bigbank-spring/ - src/ - main/ - java/ - bigbank/ - account/ - AccountComponent implementation using Spring - accountdata/ - AccountDataComponent implementation using Spring - sockquote/ - stockquote implementation using Java - client/ - starts the SCA Runtime and - deploys the BigBank.composite. - It then calls the deployed AccountService - resources/ - Account.composite - SCA assembly for this sample - BigBank.composite - SCA assembly for this sample - StockQuote.composite - SCA assembly for this sample - test/ - java/ - bigbank/ - BigBankTestCase.java - JUnit test case - simple-bigbank-spring.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd simple-bigbank-spring -ant compile -ant run - -You should see the following output. -** Please note that balance amount will vary depending on the random stock value. - -run: - [java] Spring parent context - getBean called for name: stockQuoteService - [java] Getting stock quote for: IBM, value: 104.97 - [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID -:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10497.0] - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd simple-bigbank-spring -mvn - -You should see the following output from the test phase. -** Please note that balance amount will vary depending on the random stock value. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running bigbank.BigBankTestCase -Getting stock quote for: IBM, value: 104.02 -Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234 -5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0] -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/simple-bigbank-spring/build-dojo.xml b/java/sca/samples/simple-bigbank-spring/build-dojo.xml deleted file mode 100644 index 9d282c2dd2..0000000000 --- a/java/sca/samples/simple-bigbank-spring/build-dojo.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/build.xml b/java/sca/samples/simple-bigbank-spring/build.xml deleted file mode 100644 index ecc2596d71..0000000000 --- a/java/sca/samples/simple-bigbank-spring/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/pom.xml b/java/sca/samples/simple-bigbank-spring/pom.xml deleted file mode 100644 index 5e71de9a6b..0000000000 --- a/java/sca/samples/simple-bigbank-spring/pom.xml +++ /dev/null @@ -1,277 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-simple-bigbank-spring - Apache Tuscany SCA Spring-Based Simplified BigBank Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 2.0-SNAPSHOT - - - - org.apache.ws.security - wss4j - 1.5.3 - - - - commons-httpclient - commons-httpclient - 3.0.1 - - - - commons-logging - commons-logging - 1.1 - - - javax.servlet - servlet-api - - - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-spring - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-rmi-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jms-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-rss-rome - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - sample-spring-bigbank-checkaccount - 2.0-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - org.springframework - spring-core - 2.5.5 - - - - org.springframework - spring-beans - 2.5.5 - - - - org.springframework - spring-context - 2.5.5 - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-antrun-plugin - - - - ant - ant-trax - 1.6.5 - - - - - - install-dojo - validate - - run - - - - - - - - - - - copy-dojo-files - generate-resources - - run - - - - - - - - - - - - clean-dojo-files - clean - - run - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.png b/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.png deleted file mode 100644 index 593c047f6a..0000000000 Binary files a/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.png and /dev/null differ diff --git a/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.svg b/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.svg deleted file mode 100644 index c64f6de6b9..0000000000 --- a/java/sca/samples/simple-bigbank-spring/simple-bigbank-spring.svg +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - BigBank - - AccountServiceComponent - - - - - AccountDataServiceComponent - - - currency AccountService - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java deleted file mode 100644 index 1625ff5b65..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountReport.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -import java.util.List; - -/** - */ -public class AccountReport { - private List summaries; - private String currency; - - public AccountReport(String currency, List summaries) { - this.currency = currency; - this.summaries = summaries; - } - - public List getAccountSummaries() { return summaries; } - - public String getCurrency() { return currency; } - - @Override - public String toString() { - return "currency: "+ currency + ", " + summaries; - } - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java deleted file mode 100644 index 7c9082b944..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -/** - * Interface for a account service - */ -public interface AccountService { - public AccountReport getAccountReport(String customerID); -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java deleted file mode 100644 index 6252697ffe..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/AccountServiceImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -import java.util.ArrayList; -import java.util.List; - -import org.oasisopen.sca.annotation.Service; - -import bigbank.account.checking.CheckingAccountDetails; -import bigbank.account.checking.CheckingAccountService; -import bigbank.account.savings.SavingsAccountDetails; -import bigbank.account.savings.SavingsAccountService; -import bigbank.account.stock.StockAccountDetails; -import bigbank.account.stock.StockAccountService; -import bigbank.stockquote.StockQuoteService; -import bigbank.calculator.CalculatorService; - -/** - * Account service implementation - */ -@Service(AccountService.class) -public class AccountServiceImpl implements AccountService { - - private SavingsAccountService savingsAccountService; - - private CheckingAccountService checkingAccountService; - - private StockAccountService stockAccountService; - - private CalculatorService calculatorService; - - private StockQuoteService stockQuoteService; - - private String currency; - - public AccountReport getAccountReport(String customerID) { - - // Get the checking, savings and stock accounts from the AccountData - // service component - CheckingAccountDetails checking = null; - List summaries = new ArrayList(); - try { - checking = checkingAccountService.getAccountDetails(customerID); - System.out.println("Checking account: " + checking); - summaries.add(checking.toString()); - - SavingsAccountDetails savings = savingsAccountService.getAccountDetails(customerID); - System.out.println("Savings account: " + savings); - summaries.add(savings.toString()); - - StockAccountDetails stock = stockAccountService.getAccountDetails(customerID); - System.out.println("Stock account: " + stock); - summaries.add(stock.toString()); - - // Get the stock price in USD - double price = stockQuoteService.getQuote(stock.getSymbol()); - System.out.println("Stock price for " + stock.getSymbol() + ": " + price); - - // Convert to the configured currency - if (currency.equals("EURO")) { - - // Use our fancy calculator service to convert to the target currency - price = calculatorService.multiply(price, 0.70); - - System.out.println("Converted to " + currency + ": " + price); - } - - // Calculate the value of the stock account - double stockValue = price * stock.getQuantity(); - summaries.add(stock.toString()); - - AccountReport report = new AccountReport(currency, summaries); - - return report; - } catch ( Throwable e ) { - e.printStackTrace(); - return null; - } - } - - public SavingsAccountService getSavingsAccountService() { - return savingsAccountService; - } - - public void setSavingsAccountService(SavingsAccountService savingsAccountService) { - this.savingsAccountService = savingsAccountService; - } - - public CheckingAccountService getCheckingAccountService() { - return checkingAccountService; - } - - public void setCheckingAccountService(CheckingAccountService checkingAccountService) { - this.checkingAccountService = checkingAccountService; - } - - public StockAccountService getStockAccountService() { - return stockAccountService; - } - - public void setStockAccountService(StockAccountService stockAccountService) { - this.stockAccountService = stockAccountService; - } - - public String getCurrency() { - return currency; - } - - public void setCurrency(String currency) { - this.currency = currency; - } - - public CalculatorService getCalculatorService() { - return calculatorService; - } - - public void setCalculatorService(CalculatorService calculatorService) { - this.calculatorService = calculatorService; - } - - public StockQuoteService getStockQuoteService() { - return stockQuoteService; - } - - public void setStockQuoteService(StockQuoteService stockQuoteService) { - this.stockQuoteService = stockQuoteService; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java deleted file mode 100644 index 3f81f48fb9..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountDetails.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking; - -public class CheckingAccountDetails { - private String accountNumber; - private double balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String n) { - this.accountNumber = n; - } - - public double getBalance() { - return balance; - } - - public void setBalance(double b) { - this.balance = b; - } - - @Override - public String toString() { - return accountNumber + ", balance:" + balance; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java deleted file mode 100644 index 8596181d7f..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/checking/CheckingAccountService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking; - -import org.oasisopen.sca.annotation.Remotable; -import org.oasisopen.sca.annotation.Service; - -@Service -@Remotable -public interface CheckingAccountService { - - public CheckingAccountDetails getAccountDetails(String customerID); - - public double deposit(String accountNo, double depositAmt); - - public double withdraw(String accountNo, double withdrawalAmount); - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java deleted file mode 100644 index 2b086ec467..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/feed/AccountFeedImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.feed; - -import org.apache.tuscany.sca.data.collection.Collection; -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import bigbank.account.AccountService; -import bigbank.account.AccountReport; - -/** - * @version $$Rev$$ $$Date$$ - */ - -@Service(Collection.class) -public class AccountFeedImpl implements Collection { - - @Reference - protected AccountService accountService; - - public Entry[] getAll() { - - // Add the Account report entry - String report = get("1234"); - Entry entry = new Entry("1234", report); - - return new Entry[] { entry } ; - } - - public String get(String id) { - - // Get the account report for the specified customer ID - AccountReport accreport = accountService.getAccountReport(id); - String report = accreport.getCurrency(); - - return report; - } - - public void delete(String key) throws NotFoundException { - } - - public String post(String key, String item) { - return null; - } - - public void put(String key, String item) throws NotFoundException { - } - - public Entry[] query(String queryString) { - return null; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java deleted file mode 100644 index bcac678cd7..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountDetails.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.savings; - -import java.io.Serializable; - -public class SavingsAccountDetails implements Serializable { - private String accountNumber; - private double balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String n) { - this.accountNumber = n; - } - - public double getBalance() { - return balance; - } - - public void setBalance(double b) { - this.balance = b; - } - - @Override - public String toString() { - return accountNumber + ", balance:" + balance; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java deleted file mode 100644 index 070cfe12db..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.savings; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface SavingsAccountService { - - public SavingsAccountDetails getAccountDetails(String customerID); - - public double deposit(String accountNo, double depositAmt); - - public double withdraw(String accountNo, double withdrawalAmount); - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java deleted file mode 100644 index 7682b729c3..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/savings/SavingsAccountServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.savings; - -import java.util.HashMap; -import java.util.Map; - -import org.oasisopen.sca.annotation.Service; - -@Service(SavingsAccountService.class) -public class SavingsAccountServiceImpl implements SavingsAccountService { - private Map custAcctMap = new HashMap(); - private Map savingsAccts = new HashMap(); - - public SavingsAccountServiceImpl() { - custAcctMap.put("Customer_01", "SVA_Customer_01"); - custAcctMap.put("Customer_02", "SVA_Customer_02"); - custAcctMap.put("Customer_03", "SVA_Customer_03"); - - savingsAccts.put("SVA_Customer_01", new Double(1000)); - savingsAccts.put("SVA_Customer_02", new Double(1500)); - savingsAccts.put("SVA_Customer_03", new Double(2000)); - } - - public double deposit(String accountNo, double depositAmt) { - savingsAccts.put(accountNo, new Double(savingsAccts.get(accountNo).doubleValue() + depositAmt)); - return savingsAccts.get(accountNo).doubleValue(); - } - - public SavingsAccountDetails getAccountDetails(String customerID) { - SavingsAccountDetails savingsAccount = new SavingsAccountDetails(); - savingsAccount.setAccountNumber(custAcctMap.get(customerID)); - savingsAccount.setBalance(savingsAccts.get(savingsAccount.getAccountNumber()).doubleValue()); - - return savingsAccount; - } - - public double withdraw(String accountNo, double withdrawalAmount) { - double balance = savingsAccts.get(accountNo).doubleValue(); - if ( balance - withdrawalAmount > 0 ) { - balance = balance - withdrawalAmount; - savingsAccts.put(accountNo, balance); - } - return balance; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java deleted file mode 100644 index 9f06a71bae..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountDetails.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.stock; - -public class StockAccountDetails { - private String accountNumber; - private String symbol; - private int quantity; - - public StockAccountDetails() { - } - - public StockAccountDetails(String acNo, String symbol, int qty) { - this.accountNumber = acNo; - this.symbol = symbol; - this.quantity = qty; - } - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String n) { - this.accountNumber = n; - } - - public int getQuantity() { - return quantity; - } - - public void setQuantity(int a) { - this.quantity = a; - } - - public String getSymbol() { - return symbol; - } - - public void setSymbol(String s) { - this.symbol = s; - } - - @Override - public String toString() { - return accountNumber + ", symbol:" + symbol + ", quantity:" + quantity; - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java deleted file mode 100644 index f86fda7c0f..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.stock; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface StockAccountService { - - public StockAccountDetails getAccountDetails(String customerID); - - public StockAccountDetails buy(String accountNo, String symbol, int quantity); - - public StockAccountDetails sell(String accountNo, String symbol, int quantity); - - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java deleted file mode 100644 index 488146ebeb..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/account/stock/StockAccountServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.stock; - -import java.util.HashMap; -import java.util.Map; - -import org.oasisopen.sca.annotation.Service; - -@Service(StockAccountService.class) -public class StockAccountServiceImpl implements StockAccountService { - private Map custAcctMap = new HashMap(); - private Map stockAccts = new HashMap(); - - public StockAccountServiceImpl() { - custAcctMap.put("Customer_01", "STA_Customer_01"); - custAcctMap.put("Customer_02", "STA_Customer_02"); - custAcctMap.put("Customer_03", "STA_Customer_03"); - - stockAccts.put("STA_Customer_01", new StockAccountDetails("STA_Customer_01", "IBM", 100)); - stockAccts.put("STA_Customer_02", new StockAccountDetails("STA_Customer_02", "IBM", 200)); - stockAccts.put("STA_Customer_03", new StockAccountDetails("STA_Customer_03", "SYM_3", 125)); - } - - - public StockAccountDetails buy(String accountNo, String symbol, int quantity) { - return null; - } - - public StockAccountDetails getAccountDetails(String customerID) { - return stockAccts.get(custAcctMap.get(customerID)); - } - - public StockAccountDetails sell(String accountNo, String symbol, int quantity) { - return null; - } - - - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java deleted file mode 100644 index 66a0ba0e63..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/calculator/CalculatorService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java deleted file mode 100644 index f7b940f873..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/client/BigBankClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.client; - -import org.apache.tuscany.sca.node.SCAClient; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -import bigbank.account.AccountService; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class BigBankClient { - public static void main(String[] args) throws Exception { - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankClient.class.getClassLoader()); - node.start(); - - AccountService accountService = ((SCAClient)node).getService(AccountService.class, "AccountServiceComponent"); - - System.out.println("Account summary: " + accountService.getAccountReport("Customer_01") ); - - node.stop(); - } - -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java deleted file mode 100644 index 241347e417..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/server/BigBankServer.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.server; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class BigBankServer { - - public static void main(String[] args) throws Exception { - long timeout = -1L; - if (args.length > 0) { - timeout = Long.parseLong(args[0]); - } - - System.out.println("Starting the Sample SCA Spring BigBank server..."); - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("BigBank.composite", BigBankServer.class.getClassLoader()); - node.start(); - - if (timeout < 0) { - System.out.println("Press Enter to Exit..."); - System.in.read(); - } else { - Thread.sleep(timeout); - } - - node.stop(); - - System.out.println("Bye"); - } -} diff --git a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java deleted file mode 100644 index be86627882..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/java/bigbank/stockquote/StockQuoteService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the StockQuote service. - */ -@Remotable -public interface StockQuoteService { - - public double getQuote(String symbol); -} - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/BigBank.composite b/java/sca/samples/simple-bigbank-spring/src/main/resources/BigBank.composite deleted file mode 100644 index ea2dbc7e1c..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/BigBank.composite +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite b/java/sca/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite deleted file mode 100644 index 4bb2ce61ef..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/SavingsAccount.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite b/java/sca/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite deleted file mode 100644 index 97dff499ba..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/StockAccount.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml b/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml deleted file mode 100644 index 899d8d7d62..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/Account-spring-context.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml b/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml deleted file mode 100644 index b9e26bf81b..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/SavingsAccount-context.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF b/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF deleted file mode 100644 index 32fa070ffb..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/MANIFEST.MF +++ /dev/null @@ -1,4 +0,0 @@ -Manifest-Version: 1.0 -Spring-Context: META-INF/spring/StockAccount-context.xml - - diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml b/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml deleted file mode 100644 index b30f821f7e..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/spring-context/StockAccount/META-INF/spring/StockAccount-context.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/simple-bigbank-spring/src/main/resources/web/style.css b/java/sca/samples/simple-bigbank-spring/src/main/resources/web/style.css deleted file mode 100644 index 1071583264..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/main/resources/web/style.css +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -* { font-family: arial; } - -table, th, td { border: 2px solid blue; border-collapse: collapse; } -th { color: white; background-color: blue; } diff --git a/java/sca/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java b/java/sca/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java deleted file mode 100644 index d82e383e46..0000000000 --- a/java/sca/samples/simple-bigbank-spring/src/test/java/bigbank/BigBankTestCase.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank; - -import junit.framework.TestCase; - -import bigbank.server.BigBankServer; - -/** - * Tests out the big bank service - * - */ -public class BigBankTestCase extends TestCase { - - public void testServer() throws Exception { - BigBankServer.main(new String[] {"1000"}); - } -} diff --git a/java/sca/samples/simple-bigbank/README b/java/sca/samples/simple-bigbank/README deleted file mode 100644 index acbe93a4d3..0000000000 --- a/java/sca/samples/simple-bigbank/README +++ /dev/null @@ -1,101 +0,0 @@ -Calculator Sample -================= -This sample implements a simple a version of the BigBank scenrio used in -various places in the SCA specification documents. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-bigbank.jar bigbank.client.BigBankClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-bigbank.jar bigbank.client.BigBankClient - - -Sample Overview ---------------- -This sample demonstrates a simple bank summary transaction while using Java components wired together. -SCA default binding is used. - -A request to the AccountComponent results in a request to the AccountDataComponent to get account data -which is based on a random stock quote price. Therefore result for this sample will vary on each run. - -calculator/ - src/ - main/ - java/ - bigbank/ - account/ - AccountComponent implementation - accountdata/ - AccountDataComponent implementation - stockquote/ - generates random stock prices - client/ - starts the SCA Runtime and - deploys the BigBank.composite. - It then calls the deployed AccountService - resources/ - Account.composite - SCA assembly for this sample - BigBank.composite - SCA assembly for this sample - StockQuote.composite - SCA assembly for this sample - test/ - java/ - bigbank/ - BigBankTestCase.java - JUnit test case - simple-bigbank.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd simple-bigbank -ant compile -ant run - -You should see the following output from the run target. -** Please note that the balance amount is dependent on the random sotck quote price and the -numbers may vary on each run. - -run: - [java] Getting stock quote for: IBM, value: 104.06 - [java] Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID -:Foo_SAA12345, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balanc -e:10406.0] - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd simple-bigbank -mvn - -You should see the following output from the test phase. -** Please note that the balance amount is dependent on the random sotck quote price and the numbers may vary on each run. - - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running bigbank.BigBankTestCase -Getting stock quote for: IBM, value: 104.02 -Account summary: currency: USD, [ID:Foo_CHA12345, balance:1500.0, ID:Foo_SAA1234 -5, balance:1500.0, ID:Foo_STA12345, symbol:IBM, quantity:100, balance:10402.0] -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.502 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/simple-bigbank/build.xml b/java/sca/samples/simple-bigbank/build.xml deleted file mode 100644 index a814014eae..0000000000 --- a/java/sca/samples/simple-bigbank/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank/pom.xml b/java/sca/samples/simple-bigbank/pom.xml deleted file mode 100644 index 82cbdfe4b6..0000000000 --- a/java/sca/samples/simple-bigbank/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-simple-bigbank - Apache Tuscany SCA Simplified BigBank Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/simple-bigbank/simple-bigbank.png b/java/sca/samples/simple-bigbank/simple-bigbank.png deleted file mode 100644 index 593c047f6a..0000000000 Binary files a/java/sca/samples/simple-bigbank/simple-bigbank.png and /dev/null differ diff --git a/java/sca/samples/simple-bigbank/simple-bigbank.svg b/java/sca/samples/simple-bigbank/simple-bigbank.svg deleted file mode 100644 index c64f6de6b9..0000000000 --- a/java/sca/samples/simple-bigbank/simple-bigbank.svg +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - BigBank - - AccountServiceComponent - - - - - AccountDataServiceComponent - - - currency AccountService - diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java deleted file mode 100644 index 1625ff5b65..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -import java.util.List; - -/** - */ -public class AccountReport { - private List summaries; - private String currency; - - public AccountReport(String currency, List summaries) { - this.currency = currency; - this.summaries = summaries; - } - - public List getAccountSummaries() { return summaries; } - - public String getCurrency() { return currency; } - - @Override - public String toString() { - return "currency: "+ currency + ", " + summaries; - } - -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java deleted file mode 100644 index 7c9082b944..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -/** - * Interface for a account service - */ -public interface AccountService { - public AccountReport getAccountReport(String customerID); -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java deleted file mode 100644 index 7a3c184cb2..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account; - -import java.util.ArrayList; -import java.util.List; - -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -import bigbank.accountdata.AccountDataService; -import bigbank.accountdata.CheckingAccount; -import bigbank.accountdata.SavingsAccount; -import bigbank.accountdata.StockAccount; -import bigbank.stockquote.StockQuoteService; - -/** - * Account service implementation - */ -public class AccountServiceImpl implements AccountService { - - @Reference - public AccountDataService accountDataService; - - @Reference - public StockQuoteService stockQuoteService; - - @Property - public String currency; - - public AccountReport getAccountReport(String s) { - List summaries = new ArrayList(); - - CheckingAccount ca = accountDataService.getCheckingAccount(s); - summaries.add(ca.getSummary()); - - SavingsAccount sa = accountDataService.getSavingsAccount(s); - summaries.add(sa.getSummary()); - - StockAccount sk = accountDataService.getStockAccount(s); - - double price = stockQuoteService.getQuote(sk.getSymbol()); - sk.setBalance(sk.getQuantity() * price); - - summaries.add(sk.getSummary()); - - AccountReport report = new AccountReport(currency, summaries); - - return report; - } - -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java deleted file mode 100644 index a5ae7b3955..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - -/** - * Interface for a account service - */ -public interface Account { - String getSummary(); -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java deleted file mode 100644 index c354de387b..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - -/** - * Interface for a account data service - */ -public interface AccountDataService { - public CheckingAccount getCheckingAccount(String customerID); - public SavingsAccount getSavingsAccount(String customerID); - public StockAccount getStockAccount(String customerID); -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index 000acb935c..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - - -/** - * Account data service implementation - */ -public class AccountDataServiceImpl implements AccountDataService { - - public CheckingAccount getCheckingAccount(String customerID) { - - CheckingAccount checkingAccount = new CheckingAccount(); - checkingAccount.setAccountNumber(customerID+"_"+"CHA12345"); - checkingAccount.setBalance(1500.0f); - - return checkingAccount; - } - - public SavingsAccount getSavingsAccount(String customerID) { - - SavingsAccount savingsAccount = new SavingsAccount(); - savingsAccount.setAccountNumber(customerID+"_"+"SAA12345"); - savingsAccount.setBalance(1500.0f); - - return savingsAccount; - } - - public StockAccount getStockAccount(String customerID) { - - StockAccount stockAccount = new StockAccount(); - stockAccount.setAccountNumber(customerID+"_"+"STA12345"); - stockAccount.setSymbol("IBM"); - stockAccount.setQuantity(100); - - return stockAccount; - } -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java deleted file mode 100644 index 11bdff757e..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - -/** - * An account service implementation for a checking account - */ -public class CheckingAccount implements Account { - private String accountNumber; - private double balance; - - public String getAccountNumber() { return accountNumber; } - public void setAccountNumber(String n) { this.accountNumber = n; } - - public double getBalance() { return balance; } - public void setBalance(double b) { this.balance = b; } - - public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java deleted file mode 100644 index b791024076..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - -/** - * An account service implementation for a savings account - */ -public class SavingsAccount implements Account { - private String accountNumber; - private double balance; - - public String getAccountNumber() { return accountNumber; } - public void setAccountNumber(String n) { this.accountNumber = n; } - - public double getBalance() { return balance; } - public void setBalance(double b) { this.balance = b; } - - public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java deleted file mode 100644 index 86246a3f84..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.accountdata; - -/** - * An account service implementation for a stock account - */ -public class StockAccount implements Account { - private String accountNumber; - private String symbol; - private int quantity; - private double balance; - - public String getAccountNumber() { return accountNumber; } - public void setAccountNumber(String n) { this.accountNumber = n; } - - public double getQuantity() { return quantity; } - public void setQuantity(int a) { this.quantity = a; } - - public String getSymbol() { return symbol; } - public void setSymbol(String s) { this.symbol = s; } - - public double getBalance() { return balance; } - public void setBalance(double balance) { this.balance = balance; } - - public String getSummary() { return "ID:" + accountNumber + ", symbol:" + symbol + ", quantity:" + quantity + ", balance:" + balance; } -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java deleted file mode 100644 index edbf910d37..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.client; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import bigbank.account.AccountService; - -/** - * This client program shows how to create an SCA runtime, start it, - * and locate and invoke a SCA component - */ -public class BigBankClient { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("BigBank.composite"); - - AccountService accountService = scaDomain.getService(AccountService.class, - "AccountServiceComponent"); - - System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); - - scaDomain.close(); - } - -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java deleted file mode 100644 index 0512d40b0b..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - - -/** - * This class implements the StockQuote service. - */ -public class StockQuoteImpl implements StockQuoteService { - - public double getQuote(String symbol) { - double price = 104.0 + Math.random(); - price = ((int)(price * 100)) / 100.0; - - System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); - - return price; - } - -} diff --git a/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java deleted file mode 100644 index 4770c214ab..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - -import org.oasisopen.sca.annotation.Remotable; - - -/** - * This is the business interface of the StockQuote service. - */ -@Remotable -public interface StockQuoteService { - - public double getQuote(String symbol); -} - diff --git a/java/sca/samples/simple-bigbank/src/main/resources/Account.composite b/java/sca/samples/simple-bigbank/src/main/resources/Account.composite deleted file mode 100644 index e71615e27e..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/resources/Account.composite +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - USD - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank/src/main/resources/BigBank.composite b/java/sca/samples/simple-bigbank/src/main/resources/BigBank.composite deleted file mode 100644 index c870f39cab..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/resources/BigBank.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank/src/main/resources/StockQuote.composite b/java/sca/samples/simple-bigbank/src/main/resources/StockQuote.composite deleted file mode 100644 index 4f29c14851..0000000000 --- a/java/sca/samples/simple-bigbank/src/main/resources/StockQuote.composite +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/java/sca/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java deleted file mode 100644 index ba6c1dd797..0000000000 --- a/java/sca/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import bigbank.account.AccountService; - -/** - * Tests out the big bank service - * - */ -public class BigBankTestCase extends TestCase { - - private SCADomain scaDomain; - AccountService accountService; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("BigBank.composite"); - accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); - } -} diff --git a/java/sca/samples/simple-callback-ws/README b/java/sca/samples/simple-callback-ws/README deleted file mode 100644 index 6b27718f74..0000000000 --- a/java/sca/samples/simple-callback-ws/README +++ /dev/null @@ -1,144 +0,0 @@ -Simple Callback Sample Using Web Services -========================================= -This sample demonstrates asynchronous messaging using a callback over the -Web Service binding. It is very similar to the simple-callback sample. -The only differences are that simplecallback.composite has been updated -to use the Web Service binding, and there is a simplecallback.wsdl file. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient - - -Sample Overview ---------------- -The sample provides a single composite with two components. MyClientComponent is -wired to MyServiceComponent. The interface of MyServiceComponent describes one -method as ONEWAY and with a callback semantic. When a message passes from -client to service the response is returned via the callback asynchronously. - -simple-callback/ - src/ - main/ - java/ - simplecallback/ - MyClient.java - client interface - MyClientImpl.java - implements the client and service callback - interfaces - MyService.java - service interface - MyServiceCallback.java - service callback interface, implemented by the - client - MyServiceImpl.java - implements the service interface - SimpleCallbackClient.java - starts the SCA Runtime and - deploys the simplecallback.composite. - It then calls MyClientComponent which in turn - calls MyServiceComponent - resources/ - simplecallback.composite - the SCA assembly for this sample - wsdl/ - simplecallback.wsdl - the service description and callback binding - test/ - java/ - simplecallback/ - SimpleCallbackTestCase.java - JUnit test case - simple-callback.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd simple-callback-ws -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackCo -mponent - [java] 14-Jan-2008 14:25:02 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent - [java] Main thread Thread[main,5,main] - [java] aClientMethod on thread Thread[main,5,main] - [java] aClientMethod return from someMethod on thread Thread[main,5,main] - [java] setMyServiceCallback on thread Thread[pool-1-thread-2,5,main] - [java] someMethod on thread Thread[pool-1-thread-2,5,main] - [java] receiveResult on thread Thread[pool-1-thread-4,5,main] - [java] Result: -> someMethod -> receiveResult - - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd simple-callback-ws -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running simplecallback.SimpleCallbackTestCase -14-Jan-2008 14:26:28 org.apache.catalina.core.StandardEngine start -INFO: Starting Servlet Engine: Apache Tomcat/6.0.10 -14-Jan-2008 14:26:28 org.apache.catalina.startup.ContextConfig defaultWebConfig -INFO: No default web.xml -14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/jsp_2_0.xsd -14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -1.dtd -14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_1_ -2.dtd -14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/jsp/resources/web-jsptaglibrary_2_ -0.xsd -14-Jan-2008 14:26:28 org.apache.catalina.startup.DigesterFactory register -WARNING: Could not get url for /javax/servlet/resources/j2ee_web_services_1_1.xs -d -14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol init -INFO: Initializing Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:26:28 org.apache.coyote.http11.Http11Protocol start -INFO: Starting Coyote HTTP/1.1 on http-8085 -14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceCallbackComponent -14-Jan-2008 14:26:28 org.apache.tuscany.sca.http.tomcat.TomcatServer addServletM -apping -INFO: Added Servlet mapping: http://L3AW203:8085/MyServiceComponent -Main thread Thread[main,5,main] -aClientMethod on thread Thread[main,5,main] -aClientMethod return from someMethod on thread Thread[main,5,main] -Sleeping ... -setMyServiceCallback on thread Thread[pool-1-thread-1,5,main] -someMethod on thread Thread[pool-1-thread-1,5,main] -receiveResult on thread Thread[pool-1-thread-2,5,main] -Result: -> someMethod -> receiveResult -14-Jan-2008 14:26:31 org.apache.coyote.http11.Http11Protocol destroy -INFO: Stopping Coyote HTTP/1.1 on http-8085 -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.312 sec - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/simple-callback-ws/build.xml b/java/sca/samples/simple-callback-ws/build.xml deleted file mode 100644 index 10b69bd395..0000000000 --- a/java/sca/samples/simple-callback-ws/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-callback-ws/pom.xml b/java/sca/samples/simple-callback-ws/pom.xml deleted file mode 100644 index 5b5d5e666b..0000000000 --- a/java/sca/samples/simple-callback-ws/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-simple-callback-ws - Apache Tuscany SCA Simple Callback Web Service Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/simple-callback-ws/simple-callback-ws.png b/java/sca/samples/simple-callback-ws/simple-callback-ws.png deleted file mode 100644 index 1b6353f5cf..0000000000 Binary files a/java/sca/samples/simple-callback-ws/simple-callback-ws.png and /dev/null differ diff --git a/java/sca/samples/simple-callback-ws/simple-callback-ws.svg b/java/sca/samples/simple-callback-ws/simple-callback-ws.svg deleted file mode 100644 index 7d9e3de510..0000000000 --- a/java/sca/samples/simple-callback-ws/simple-callback-ws.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - simplecallback - MyServiceComponent - - - MyClientComponent - - - diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java deleted file mode 100644 index 4cc00d6d0f..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClient.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -/** - * The client interface - */ -public interface MyClient { - - void aClientMethod(); -} diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java deleted file mode 100644 index 7ecb51036f..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyClientImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * Demonstrates a component-to-component callback invocation - */ -@Service(MyClient.class) -@Scope("COMPOSITE") -public class MyClientImpl implements MyClient, MyServiceCallback { - - private MyService myService; - static String result; - - @Reference - public void setMyService(MyService myService) { - this.myService = myService; - } - - public void aClientMethod() { - System.out.println("aClientMethod on thread " + Thread.currentThread()); - myService.someMethod("-> someMethod"); - System.out.println("aClientMethod return from someMethod on thread " + Thread.currentThread()); - } - - public void receiveResult(String result) { - System.out.println("receiveResult on thread " + Thread.currentThread()); - System.out.println("Result: " + result); - MyClientImpl.result = result; - } -} diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java deleted file mode 100644 index 7a72f50964..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; -import org.oasisopen.sca.annotation.Remotable; - -/** - * This service that will be invoked in a non-blocking fashion - */ -@Remotable -@Callback(MyServiceCallback.class) -public interface MyService { - - @OneWay - void someMethod(String arg); -} diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java deleted file mode 100644 index dd26439619..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceCallback.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * The callback interface for {@link MyService}. - */ -@Remotable -public interface MyServiceCallback { - - void receiveResult(String result); -} diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java deleted file mode 100644 index 6a31d90458..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/MyServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements MyService and uses a callback. - */ -@Service(MyService.class) -@Scope("COMPOSITE") -public class MyServiceImpl implements MyService { - - private MyServiceCallback myServiceCallback; - - /** - * The setter used by the runtime to set the callback reference - * @param myServiceCallback - */ - @Callback - public void setMyServiceCallback(MyServiceCallback myServiceCallback) { - System.out.println("setMyServiceCallback on thread " + Thread.currentThread()); - this.myServiceCallback = myServiceCallback; - } - - public void someMethod(String arg) { - System.out.println("someMethod on thread " + Thread.currentThread()); - // invoke the callback - try { - myServiceCallback.receiveResult(arg + " -> receiveResult"); - } catch(RuntimeException e) { - System.out.println("RuntimeException invoking receiveResult: " + e.toString()); - e.printStackTrace(); - } - } -} diff --git a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java b/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java deleted file mode 100644 index eeb0e52163..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/java/simplecallback/SimpleCallbackClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Demonstrates resolving the client service and initiating the callback sequence - */ -public class SimpleCallbackClient { - - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite"); - MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); - - System.out.println("Main thread " + Thread.currentThread()); - myClient.aClientMethod(); - Thread.sleep(1000); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/simple-callback-ws/src/main/resources/simplecallback.composite b/java/sca/samples/simple-callback-ws/src/main/resources/simplecallback.composite deleted file mode 100644 index 53e7fe66af..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/resources/simplecallback.composite +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl b/java/sca/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl deleted file mode 100644 index 8a6465de3a..0000000000 --- a/java/sca/samples/simple-callback-ws/src/main/resources/wsdl/simplecallback.wsdl +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java b/java/sca/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java deleted file mode 100644 index 580a7f6b0c..0000000000 --- a/java/sca/samples/simple-callback-ws/src/test/java/simplecallback/SimpleCallbackTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * A testcase that demonstrates resolving the client service and initiating the callback sequence - */ -public class SimpleCallbackTestCase extends TestCase { - - private SCADomain scaDomain; - private MyClient myClient; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("simplecallback.composite"); - myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - System.out.println("Main thread " + Thread.currentThread()); - myClient.aClientMethod(); - System.out.println("Sleeping ..."); - Thread.sleep(2000); - assertEquals("-> someMethod -> receiveResult", MyClientImpl.result); - } -} - - diff --git a/java/sca/samples/simple-callback/README b/java/sca/samples/simple-callback/README deleted file mode 100644 index 719376f254..0000000000 --- a/java/sca/samples/simple-callback/README +++ /dev/null @@ -1,97 +0,0 @@ -Simple Callback Sample -====================== -This sample demonstrates asynchronous messaging using a callback. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-simple-callback.jar simplecallback.SimpleCallbackClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-simple-callback.jar simplecallback.SimpleCallbackClient - - -Sample Overview ---------------- -The sample provides a single composite with two components. MyClientComponent is -wired to MyServiceComponent. The interface of MyServiceComponent describes one -method as ONEWAY and with a callback semantic. When a message passes from -client to service the response is returned via the callback asynchronously. - -simple-callback/ - src/ - main/ - java/ - simplecallback/ - MyClient.java - client interface - MyClientImpl.java - implements the client and service callback - interfaces - MyService.java - service interface - MyServiceCallback.java - service callback interface, implemented by the - client - MyServiceImpl.java - implements the service interface - SimpleCallbackClient.java - starts the SCA Runtime and - deploys the simplecallback.composite. - It then calls MyClientComponent which in turn - calls MyServiceComponent - resources/ - simplecallback.composite - the SCA assembly for this sample - test/ - java/ - simplecallback/ - SimpleCallbackTestCase.java - JUnit test case - simple-callback.png - a pictorial representation of the sample - .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd simple-callback -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Main thread Thread[main,5,main] - [java] Work thread Thread[pool-1-thread-1,5,main] - [java] Result: -> someMethod -> receiveResult - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd simple-callback -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running simplecallback.SimpleCallbackTestCase -Main thread Thread[main,5,main] -Sleeping ... -Work thread Thread[pool-1-thread-1,5,main] -Result: -> someMethod -> receiveResult -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.692 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. diff --git a/java/sca/samples/simple-callback/build.xml b/java/sca/samples/simple-callback/build.xml deleted file mode 100644 index 47d1ea4bc1..0000000000 --- a/java/sca/samples/simple-callback/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-callback/pom.xml b/java/sca/samples/simple-callback/pom.xml deleted file mode 100644 index 056aef6a1e..0000000000 --- a/java/sca/samples/simple-callback/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-simple-callback - Apache Tuscany SCA Simple Callback Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/simple-callback/simple-callback.png b/java/sca/samples/simple-callback/simple-callback.png deleted file mode 100644 index 1b6353f5cf..0000000000 Binary files a/java/sca/samples/simple-callback/simple-callback.png and /dev/null differ diff --git a/java/sca/samples/simple-callback/simple-callback.svg b/java/sca/samples/simple-callback/simple-callback.svg deleted file mode 100644 index 484b65df9d..0000000000 --- a/java/sca/samples/simple-callback/simple-callback.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - simplecallback - MyServiceComponent - - - MyClientComponent - - - diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClient.java deleted file mode 100644 index 4cc00d6d0f..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClient.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -/** - * The client interface - */ -public interface MyClient { - - void aClientMethod(); -} diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java deleted file mode 100644 index 18e159edc3..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * Demonstrates a component-to-component callback invocation - */ -@Service(MyClient.class) -@Scope("COMPOSITE") -public class MyClientImpl implements MyClient, MyServiceCallback { - - private MyService myService; - static String result; - - @Reference - public void setMyService(MyService myService) { - this.myService = myService; - } - - public void aClientMethod() { - myService.someMethod("-> someMethod"); - } - - public void receiveResult(String result) { - System.out.println("Work thread " + Thread.currentThread()); - System.out.println("Result: " + result); - MyClientImpl.result = result; - } -} diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyService.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/MyService.java deleted file mode 100644 index a065408954..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.OneWay; - -/** - * This service that will be invoked in a non-blocking fashion - */ -@Callback(MyServiceCallback.class) -public interface MyService { - - @OneWay - void someMethod(String arg); -} diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java deleted file mode 100644 index b27eea44f5..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -/** - * The callback interface for {@link MyService}. - */ -public interface MyServiceCallback { - - void receiveResult(String result); -} diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java deleted file mode 100644 index dc5493babe..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.oasisopen.sca.annotation.Callback; -import org.oasisopen.sca.annotation.Scope; -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements MyService and uses a callback. - */ -@Service(MyService.class) -@Scope("COMPOSITE") -public class MyServiceImpl implements MyService { - - private MyServiceCallback myServiceCallback; - - /** - * The setter used by the runtime to set the callback reference - * @param myServiceCallback - */ - @Callback - public void setMyServiceCallback(MyServiceCallback myServiceCallback) { - this.myServiceCallback = myServiceCallback; - } - - public void someMethod(String arg) { - // invoke the callback - try { - myServiceCallback.receiveResult(arg + " -> receiveResult"); - } catch(RuntimeException e) { - System.out.println("RuntimeException invoking receiveResult: " + e.toString()); - } - } -} diff --git a/java/sca/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/java/sca/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java deleted file mode 100644 index b8987fcd07..0000000000 --- a/java/sca/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * Demonstrates resolving the client service and initiating the callback sequence - */ -public class SimpleCallbackClient { - - public static void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("simplecallback.composite"); - MyClient myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); - - System.out.println("Main thread " + Thread.currentThread()); - myClient.aClientMethod(); - Thread.sleep(500); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/simple-callback/src/main/resources/simplecallback.composite b/java/sca/samples/simple-callback/src/main/resources/simplecallback.composite deleted file mode 100644 index 33e6f60601..0000000000 --- a/java/sca/samples/simple-callback/src/main/resources/simplecallback.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/java/sca/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java deleted file mode 100644 index cbaab8af83..0000000000 --- a/java/sca/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package simplecallback; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * A testcase that demonstrates resolving the client service and initiating the callback sequence - */ -public class SimpleCallbackTestCase extends TestCase { - - private SCADomain scaDomain; - private MyClient myClient; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("simplecallback.composite"); - myClient = scaDomain.getService(MyClient.class, "MyClientComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - System.out.println("Main thread " + Thread.currentThread()); - myClient.aClientMethod(); - System.out.println("Sleeping ..."); - Thread.sleep(300); - assertEquals("-> someMethod -> receiveResult", MyClientImpl.result); - } -} diff --git a/java/sca/samples/spi-implementation-pojo/pom.xml b/java/sca/samples/spi-implementation-pojo/pom.xml deleted file mode 100644 index 870c67b5f2..0000000000 --- a/java/sca/samples/spi-implementation-pojo/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-spi-implementation-java - Apache Tuscany Java Implementation SPI Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-extension-helper - 2.0-SNAPSHOT - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java b/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java deleted file mode 100644 index 73104c3166..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementation.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - - -public class JavaImplementation { - - private String className; - - public String getClass_() { - return className; - } - - public void setClass_(String className) { - this.className = className; - } - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java b/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java deleted file mode 100644 index 43efae32ca..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaImplementationActivator.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.spi.ImplementationActivator; -import org.apache.tuscany.sca.spi.InvokerFactory; - -public class JavaImplementationActivator implements ImplementationActivator { - - public Class getImplementationClass() { - return JavaImplementation.class; - } - - public InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) { - return new JavaInvokerFactory(rc, ct, implementation); - } - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java b/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java deleted file mode 100644 index b33d9a3644..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvoker.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.oasisopen.sca.ServiceRuntimeException; - -public class JavaInvoker implements Invoker { - - protected Class clazz; - protected Object instance; - protected Operation operation; - - public JavaInvoker(Class clazz, Object instance, Operation operation) { - this.clazz = clazz; - this.instance = instance; - this.operation = operation; - } - - public Message invoke(Message msg) { - try { - msg.setBody(getMethod().invoke(instance, (Object[])msg.getBody())); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - return msg; - } - - protected Method getMethod() { - for (Method method : clazz.getMethods()) { - if (method.getName().equals(operation.getName())) { - return method; - } - } - throw new ServiceRuntimeException("no method found for operation: " + operation.getName()); - } - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java b/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java deleted file mode 100644 index 92c92eb309..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/main/java/sample/JavaInvokerFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package sample; - -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.spi.InvokerFactory; -import org.oasisopen.sca.ServiceRuntimeException; - -public class JavaInvokerFactory implements InvokerFactory { - - protected Object instance; - protected Class clazz; - - public JavaInvokerFactory(RuntimeComponent rc, ComponentType ct, JavaImplementation implementation) { - try { - this.clazz = Class.forName(implementation.getClass_()); - this.instance = clazz.newInstance(); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } - - public Invoker createInvoker(Operation operation) { - return new JavaInvoker(clazz, instance, operation); - } - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator b/java/sca/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator deleted file mode 100644 index 95ee37c1aa..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.ImplementationActivator +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# Implementation class for the ExtensionActivator -sample.JavaImplementationActivator diff --git a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java b/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java deleted file mode 100644 index cc32929f09..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorld.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -public interface HelloWorld { - - String sayHello(String name); - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java b/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 02af1ccf22..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package helloworld; - -public class HelloWorldImpl implements HelloWorld { - - public String sayHello(String name) { - return "Hello " + name; - } - -} diff --git a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java b/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java deleted file mode 100644 index 5813fda330..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/test/java/helloworld/HelloWorldTestCase.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package helloworld; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - */ -public class HelloWorldTestCase extends TestCase { - - public void testHello() throws Exception { - SCADomain scaDomain = SCADomain.newInstance("helloworld/helloworld.composite"); - HelloWorld helloworld = scaDomain.getService(HelloWorld.class, "HelloWorldComponent"); - assertEquals("Hello petra", helloworld.sayHello("petra")); - scaDomain.close(); - } -} diff --git a/java/sca/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite b/java/sca/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite deleted file mode 100644 index fa9cecc160..0000000000 --- a/java/sca/samples/spi-implementation-pojo/src/test/resources/helloworld/helloworld.composite +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-calculator/README b/java/sca/samples/spring-bigbank-calculator/README deleted file mode 100644 index 3869ea6a12..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/README +++ /dev/null @@ -1,2 +0,0 @@ -Spring-bigbank-calculator is part of a spring-bigbank sample. -Please see the Readme file under spring-bigbank to understand how spring-bigbank-calculator fits into the overall picture. diff --git a/java/sca/samples/spring-bigbank-calculator/build.xml b/java/sca/samples/spring-bigbank-calculator/build.xml deleted file mode 100644 index 9d69ee9ba0..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-calculator/pom.xml b/java/sca/samples/spring-bigbank-calculator/pom.xml deleted file mode 100644 index 5f2b2452ab..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-spring-bigbank-calculator - Apache Tuscany SCA Spring-Based BigBank Calculator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-script - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-spring - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-rmi-runtime - 2.0-SNAPSHOT - runtime - - - - org.springframework - spring-core - 2.5.5 - - - - org.springframework - spring-beans - 2.5.5 - - - - org.springframework - spring-context - 2.5.5 - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java deleted file mode 100644 index ecaa4e28de..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/AddService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -public interface AddService { - - double add(double n1, double n2); - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java deleted file mode 100644 index 66a0ba0e63..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorService.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -/** - * The Calculator service interface. - */ -public interface CalculatorService { - - double add(double n1, double n2); - - double subtract(double n1, double n2); - - double multiply(double n1, double n2); - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 665dbbf9ac..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/CalculatorServiceImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -/** - * An implementation of the Calculator service. - */ -@Service(CalculatorService.class) -public class CalculatorServiceImpl implements CalculatorService { - - private AddService addService; - private SubtractService subtractService; - private MultiplyService multiplyService; - private DivideService divideService; - - @Reference - public void setAddService(AddService addService) { - this.addService = addService; - } - - @Reference - public void setSubtractService(SubtractService subtractService) { - this.subtractService = subtractService; - } - - @Reference - public void setDivideService(DivideService divideService) { - this.divideService = divideService; - } - - @Reference - public void setMultiplyService(MultiplyService multiplyService) { - this.multiplyService = multiplyService; - } - - public double add(double n1, double n2) { - return addService.add(n1, n2); - } - - public double subtract(double n1, double n2) { - return subtractService.subtract(n1, n2); - } - - public double multiply(double n1, double n2) { - System.err.println("Multiply"); - return multiplyService.multiply(n1, n2); - } - - public double divide(double n1, double n2) { - return divideService.divide(n1, n2); - } - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java deleted file mode 100644 index 22e9d58a94..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/DivideService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java deleted file mode 100644 index ba3d43448e..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/MultiplyService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -public interface MultiplyService { - - double multiply(double n1, double n2); - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java deleted file mode 100644 index 17691af0e8..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/SubtractService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java b/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java deleted file mode 100644 index c6a230fcb4..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/java/bigbank/calculator/server/CalculatorServer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.calculator.server; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -public class CalculatorServer { - - public static void main(String[] args) throws Exception { - long timeout = -1L; - if (args.length > 0) { - timeout = Long.parseLong(args[0]); - } - - System.out.println("Starting the Sample SCA Calculator..."); - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorServer.class.getClassLoader()); - node.start(); - - if (timeout < 0) { - System.out.println("Press Enter to Exit..."); - System.in.read(); - } else { - Thread.sleep(timeout); - } - - node.stop(); - System.out.println("Bye"); - } - -} diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite b/java/sca/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite deleted file mode 100644 index 504a4ccfcd..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/Calculator.composite +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml b/java/sca/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml deleted file mode 100644 index 42e5f824f9..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/META-INF/spring/CalculatorService-context.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js b/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js deleted file mode 100644 index 6f11106ddd..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/AddServiceImpl.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -function add(n1, n2) { - return n1 + n2; -} \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy deleted file mode 100644 index c31c1e8fd6..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/DivideServiceImpl.groovy +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -def divide(n1, n2) { - return n1 / n2 -} \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py deleted file mode 100644 index cfd96f287a..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/MultiplyServiceImpl.py +++ /dev/null @@ -1,21 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -def multiply(n1, n2): - print "Python Calculator component: multiply(", n1, ",", n2, ")" - return n1 * n2 \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb deleted file mode 100644 index 8e7a884d41..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/main/resources/calculator/SubtractServiceImpl.rb +++ /dev/null @@ -1,22 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -def subtract(n1, n2) - print "Ruby Calculator subtract(", n1, ",", n2, ")\n" - return n1 - n2 -end \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java b/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java deleted file mode 100644 index 02a11485cd..0000000000 --- a/java/sca/samples/spring-bigbank-calculator/src/test/java/bigbank/calculator/CalculatorServiceTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.calculator; - -import junit.framework.TestCase; -import bigbank.calculator.server.CalculatorServer; - -/** - * Tests out the big bank service - * - */ -public class CalculatorServiceTestCase extends TestCase { - - public void testServer() throws Exception { - CalculatorServer.main(new String[] {"1000"}); - } -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/README b/java/sca/samples/spring-bigbank-checkaccount/README deleted file mode 100644 index 17b71e7590..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/README +++ /dev/null @@ -1,4 +0,0 @@ -Spring-bigbank-checkaccount is a part of a spring-bigbank sample. -Please see the Readme file under spring-bigbank to understand how spring-bigbank-checkaccount fits into the overall picture. - - diff --git a/java/sca/samples/spring-bigbank-checkaccount/build.xml b/java/sca/samples/spring-bigbank-checkaccount/build.xml deleted file mode 100644 index 26d71c146f..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-checkaccount/pom.xml b/java/sca/samples/spring-bigbank-checkaccount/pom.xml deleted file mode 100644 index b46074b8c8..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/pom.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-spring-bigbank-checkaccount - Apache Tuscany SCA Spring-Based BigBank Checking Accounts Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-policy-security - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-spring - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jms-runtime - 2.0-SNAPSHOT - runtime - - - - org.springframework - spring-core - 2.5.5 - - - - org.springframework - spring-beans - 2.5.5 - - - - org.springframework - spring-context - 2.5.5 - - - - org.apache.ws.security - wss4j - 1.5.3 - - - - junit - junit - 4.5 - test - - - - org.apache.activemq - apache-activemq - 4.1.1 - - - org.apache.activemq - activemq-web-demo - - - - - - - ${artifactId} - - diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java deleted file mode 100644 index 9737ac27eb..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountDetails.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking; - -/** - * @version $$Rev: 635619 $$ $$Date: 2007-04-09 12:03:34 -0700 (Mon, 09 Apr - * 2007) $$ - */ - -public class CheckingAccountDetails { - private String accountNumber; - private double balance; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String n) { - this.accountNumber = n; - } - - public double getBalance() { - return balance; - } - - public void setBalance(double b) { - this.balance = b; - } - - @Override - public String toString() { - return accountNumber + ", balance:" + balance; - } -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java deleted file mode 100644 index 4d8b03fc7d..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountService.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking; - -import org.oasisopen.sca.annotation.Remotable; -import org.oasisopen.sca.annotation.Service; - -/** - * @version $$Rev: 636465 $$ $$Date: 2008-03-13 00:49:26 +0530 (Thu, 13 Mar 2008) $$ - */ -@Service -@Remotable -public interface CheckingAccountService { - - public CheckingAccountDetails getAccountDetails(String customerID); - - public double deposit(String accountNo, double depositAmt); - - public double withdraw(String accountNo, double withdrawalAmount); - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java deleted file mode 100644 index 3ed3086dbd..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/CheckingAccountServiceImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking; - -import java.util.HashMap; -import java.util.Map; - -import org.oasisopen.sca.annotation.Service; - -/** - * - * */ - -@Service(CheckingAccountService.class) -public class CheckingAccountServiceImpl implements CheckingAccountService { - private Map custAcctMap = new HashMap(); - private Map checkingAccts = new HashMap(); - - public CheckingAccountServiceImpl() { - custAcctMap.put("Customer_01", "CHA_Customer_01"); - custAcctMap.put("Customer_02", "CHA_Customer_02"); - custAcctMap.put("Customer_03", "CHA_Customer_03"); - - checkingAccts.put("CHA_Customer_01", new Double(1000)); - checkingAccts.put("CHA_Customer_02", new Double(1500)); - checkingAccts.put("CHA_Customer_03", new Double(2000)); - } - - public double deposit(String accountNo, double depositAmt) { - checkingAccts.put(accountNo, new Double(checkingAccts.get(accountNo).doubleValue() + depositAmt)); - return checkingAccts.get(accountNo).doubleValue(); - } - - public CheckingAccountDetails getAccountDetails(String customerID) { - CheckingAccountDetails checkingAccount = new CheckingAccountDetails(); - checkingAccount.setAccountNumber(custAcctMap.get(customerID)); - checkingAccount.setBalance(checkingAccts.get(checkingAccount.getAccountNumber()).doubleValue()); - - return checkingAccount; - } - - public double withdraw(String accountNo, double withdrawalAmount) { - double balance = checkingAccts.get(accountNo).doubleValue(); - if ( balance - withdrawalAmount > 0 ) { - balance = balance - withdrawalAmount; - checkingAccts.put(accountNo, balance); - } - return balance; - } -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java deleted file mode 100644 index 562314230a..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/checking/server/CheckingAccountServer.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.checking.server; - -import java.io.IOException; - -import org.apache.activemq.broker.BrokerService; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -/** - * This server program shows how to create an SCA runtime, and start it which - * activates the Spring BigBank CheckingsAccount JMS endpoint. - */ -public class CheckingAccountServer { - - public static void main(String[] args) { - long timeout = -1L; - if (args.length > 0) { - timeout = Long.parseLong(args[0]); - } - - try { - BrokerService jmsBroker; - jmsBroker = new BrokerService(); - jmsBroker.setPersistent(false); - jmsBroker.setUseJmx(false); - jmsBroker.addConnector("tcp://localhost:61619"); - jmsBroker.start(); - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("CheckingsAccount.composite", CheckingAccountServer.class.getClassLoader()); - node.start(); - - if (timeout < 0) { - System.out.println("CheckingsAccount server started (press enter to shutdown)"); - System.in.read(); - } else { - Thread.sleep(timeout); - } - - node.stop(); - - jmsBroker.stop(); - System.out.println("CheckingsAccount server stopped"); - - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java deleted file mode 100644 index ad17ab8cf5..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/AccountsDataPasswordCallbackHandler.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.security; - -import java.io.IOException; - -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.UnsupportedCallbackException; - -import org.apache.ws.security.WSPasswordCallback; - -/** - * Sample userid passwd generation class - */ -public class AccountsDataPasswordCallbackHandler implements CallbackHandler { - - public void handle(Callback[] callbacks) throws IOException, - UnsupportedCallbackException { - for (int i = 0; i < callbacks.length; i++) { - WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i]; - if ( pwcb.getUsage() == WSPasswordCallback.SIGNATURE ) { - System.out.println(" Usage is SIGNATURE ... "); - pwcb.setPassword("bbservice"); - } else if ( pwcb.getUsage() == WSPasswordCallback.USERNAME_TOKEN_UNKNOWN ) { - System.out.println("*** Calling ACCOUNTS-DATA Passwd Handler for AUTHENTICATING userID = " - + pwcb.getIdentifer() + " and password = " + pwcb.getPassword() ); - if ( pwcb.getIdentifer().equals("bbaservice") && pwcb.getPassword().equals("bbaservice")) { - System.out.println("AUTHENTICATION SUCCESSFUL!"); - } else { - System.out.println("AUTHENTICATION FAILED!"); - throw new UnsupportedCallbackException(pwcb, "UserId - Password Authentication Failed!"); - } - } - } - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java deleted file mode 100644 index 7b44a28bc9..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/BigbankCheckingsAcl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.account.security; - -import java.security.Principal; -import java.util.Hashtable; -import java.util.Map; - -/** - * @version $Rev: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $ - */ -public class BigbankCheckingsAcl { - private static MapcheckingsAcl = new Hashtable(); - - static { - checkingsAcl.put("bbaservice", "Customer_01"); - checkingsAcl.put("bbUser01", "Customer_01"); - } - - - public static void authorize(Principal principal, String resource) { - if ( checkingsAcl.get(principal.getName()) == null || - !checkingsAcl.get(principal.getName()).equals(resource) ) { - throw new RuntimeException("User - " + principal.getName() + " not authorized to access account " + - resource); - } else { - System.out.println("Successfully Authorized '" + principal.getName() + " to access accounts of " + resource); - } - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java deleted file mode 100644 index bbd5b0c325..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthImplementationPolicyProvider.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.account.security; - -import org.apache.tuscany.sca.assembly.ConfiguredOperation; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.OperationsConfigurator; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Phase; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ - */ -public class CheckingsDeptAuthImplementationPolicyProvider implements PolicyProvider { - private RuntimeComponent component; - private Implementation implementation; - - public CheckingsDeptAuthImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { - super(); - this.component = component; - this.implementation = implementation; - } - - private String getContext() { - return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")"; - } - - private PolicySet findPolicySet(Operation operation) { - for (PolicySet ps : component.getPolicySets()) { - for (Object p : ps.getPolicies()) { - if (CheckingsDeptAuthPolicy.class.isInstance(p)) { - return ps; - } - } - } - - if ( component instanceof OperationsConfigurator ) { - for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) { - if ( confOp.getName().equals(operation.getName())) { - for (PolicySet ps : confOp.getPolicySets()) { - for (Object p : ps.getPolicies()) { - if (CheckingsDeptAuthPolicy.class.isInstance(p)) { - return ps; - } - } - } - } - } - } - - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation) - */ - public Interceptor createInterceptor(Operation operation) { - PolicySet ps = findPolicySet(operation); - return ps == null ? null : new CheckingsDeptAuthPolicyInterceptor(getContext(), operation, ps); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase() - */ - public String getPhase() { - return Phase.IMPLEMENTATION_POLICY; - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java deleted file mode 100644 index cb26ca809d..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicy.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.account.security; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.policy.Policy; - -/** - * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ - */ -public class CheckingsDeptAuthPolicy implements Policy { - - public QName getSchemaName() { - // TODO Auto-generated method stub - return null; - } - - public boolean isUnresolved() { - // TODO Auto-generated method stub - return false; - } - - public void setUnresolved(boolean unresolved) { - // TODO Auto-generated method stub - - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java deleted file mode 100644 index 5c692df4ec..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyInterceptor.java +++ /dev/null @@ -1,73 +0,0 @@ -package bigbank.account.security; - -import java.security.Principal; - -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.invocation.Interceptor; -import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.SecurityUtil; - -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * Policy handler to handle PolicySet related to Logging with the QName - * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy - */ -public class CheckingsDeptAuthPolicyInterceptor implements Interceptor { - private Invoker next; - - public CheckingsDeptAuthPolicyInterceptor(String context, Operation operation, PolicySet policySet) { - super(); - init(); - } - - private final void init() { - } - - public Message invoke(Message msg) { - Object msgBody = msg.getBody(); - if (msgBody instanceof Object[]) { - Object args[] = (Object[])msg.getBody(); - Principal principal = SecurityUtil.getPrincipal(msg); - if (principal != null){ - BigbankCheckingsAcl.authorize(principal, - (String)args[0]); - } - } - - Message responseMsg = null; - try { - responseMsg = getNext().invoke(msg); - return responseMsg; - } catch (RuntimeException e) { - throw e; - } - } - - public Invoker getNext() { - return next; - } - - public void setNext(Invoker next) { - this.next = next; - } -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java deleted file mode 100644 index 24da9878a5..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthPolicyProviderFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.account.security; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.provider.PolicyProvider; -import org.apache.tuscany.sca.provider.PolicyProviderFactory; -import org.apache.tuscany.sca.runtime.RuntimeComponent; -import org.apache.tuscany.sca.runtime.RuntimeComponentReference; -import org.apache.tuscany.sca.runtime.RuntimeComponentService; - -/** - * @version $Rev: 641726 $ $Date: 2008-03-27 12:54:37 +0530 (Thu, 27 Mar 2008) $ - */ -public class CheckingsDeptAuthPolicyProviderFactory implements PolicyProviderFactory { - private ExtensionPointRegistry registry; - - public CheckingsDeptAuthPolicyProviderFactory(ExtensionPointRegistry registry) { - super(); - this.registry = registry; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation) - */ - public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) { - return new CheckingsDeptAuthImplementationPolicyProvider(component, implementation); - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createReferencePolicyProvider(RuntimeComponent component, - RuntimeComponentReference reference, - Binding binding) { - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding) - */ - public PolicyProvider createServicePolicyProvider(RuntimeComponent component, - RuntimeComponentService service, - Binding binding) { - return null; - } - - /** - * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType() - */ - public Class getModelType() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java deleted file mode 100644 index b023adf907..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package bigbank.account.security; - -import java.security.Principal; - -import org.apache.tuscany.sca.invocation.Message; -import org.apache.tuscany.sca.policy.PolicySet; -import org.apache.tuscany.sca.policy.SecurityUtil; -import org.apache.tuscany.sca.policy.util.PolicyHandler; - -/** - * @version $Rev: 635619 $ $Date: 2008-03-10 23:24:29 +0530 (Mon, 10 Mar 2008) $ - */ -public class CheckingsDeptAuthorizationPolicyHandler implements PolicyHandler { - private PolicySet applicablePolicySet = null; - - public void afterInvoke(Object... context) { - } - - public void beforeInvoke(Object... context) { - for ( int count = 0 ; count < context.length ; ++count ) { - if ( context[count] instanceof Message ) { - Message msg = (Message)context[count]; - Object args[] = (Object[])msg.getBody(); - Principal principal = SecurityUtil.getPrincipal(msg); - if (principal != null){ - BigbankCheckingsAcl.authorize(principal, - (String)args[0]); - } - } - } - } - - public void cleanUp(Object... arg0) { - } - - public PolicySet getApplicablePolicySet() { - return this.applicablePolicySet; - } - - public void setApplicablePolicySet(PolicySet policySet) { - this.applicablePolicySet = policySet; - } - - public void setUp(Object... arg0) { - - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java b/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java deleted file mode 100644 index 96a5b2ca1f..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/java/bigbank/account/security/CheckingsDeptAuthorizationPolicyProcessor.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.account.security; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; - -/** - * Implementation of a Policy Processor - * - */ -public class CheckingsDeptAuthorizationPolicyProcessor implements StAXArtifactProcessor { - private static final QName CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME = new QName("http://bigbank/checkings", "AuthPolicy"); - public QName getArtifactType() { - return CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME; - } - - public CheckingsDeptAuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories) { - } - - - public CheckingsDeptAuthPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - CheckingsDeptAuthPolicy policy = new CheckingsDeptAuthPolicy(); - return policy; - } - - public void write(CheckingsDeptAuthPolicy policy, XMLStreamWriter writer) throws ContributionWriteException, - XMLStreamException { - String prefix = "tuscany"; - writer.writeStartElement(prefix, - CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getLocalPart(), - CHECKINGS_DEPT_AUTHORIZATION_POLICY_QNAME.getNamespaceURI()); - writer.writeNamespace("chk", "http://bigbank/checkings"); - - - writer.writeEndElement(); - } - - public Class getModelType() { - return CheckingsDeptAuthPolicy.class; - } - - public void resolve(CheckingsDeptAuthPolicy arg0, ModelResolver arg1) throws ContributionResolveException { - - } - -} diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite deleted file mode 100644 index 371a1afd32..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/CheckingsAccount.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 6491a0d326..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the artifact processor extension -bigbank.account.security.CheckingsDeptAuthorizationPolicyProcessor;qname=http://bigbank/checkings#AuthPolicy,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler deleted file mode 100644 index b1bce4339d..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler +++ /dev/null @@ -1,20 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures -# handler classname;qname=;model= -bigbank.account.security.CheckingsDeptAuthorizationPolicyHandler;intent=http://bigbankAccount#authorization,model=bigbank.account.security.CheckingsDeptAuthPolicy diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory deleted file mode 100644 index d6bfe2167e..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# Implementation class for the policy extension -bigbank.account.security.CheckingsDeptAuthPolicyProviderFactory;model=bigbank.account.security.CheckingsDeptAuthPolicy \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml deleted file mode 100644 index 0ce1440ddf..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/definitions.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - Authorization Intent - - - - - - - - - UsernameToken - bigbank.account.security.AccountsDataPasswordCallbackHandler - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml b/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml deleted file mode 100644 index 6b2338f611..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/main/resources/spring-context/META-INF/spring/CheckingAccountService-context.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java b/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java deleted file mode 100644 index a45630278b..0000000000 --- a/java/sca/samples/spring-bigbank-checkaccount/src/test/java/bigbank/checkaccount/CheckAccountServiceTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.checkaccount; - -import junit.framework.TestCase; -import bigbank.account.checking.server.CheckingAccountServer; - -/** - * Tests out the big bank service - * - */ -public class CheckAccountServiceTestCase extends TestCase { - - public void testServer() throws Exception { - CheckingAccountServer.main(new String[] {"1000"}); - } -} diff --git a/java/sca/samples/spring-bigbank-stockquote/README b/java/sca/samples/spring-bigbank-stockquote/README deleted file mode 100644 index b90bafeb59..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/README +++ /dev/null @@ -1,4 +0,0 @@ -Spring-bigbank-stockquote is a part of a spring-bigbank sample. -Please see the Readme file under spring-bigbank to understand how spring-bigbank-stockquote fits into the overall picture. - - diff --git a/java/sca/samples/spring-bigbank-stockquote/build.xml b/java/sca/samples/spring-bigbank-stockquote/build.xml deleted file mode 100644 index 1b38a40495..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/build.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-stockquote/pom.xml b/java/sca/samples/spring-bigbank-stockquote/pom.xml deleted file mode 100644 index 4bf37e88fa..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-spring-bigbank-stockquote - Apache Tuscany SCA Spring-Based BigBank StockQuote Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-spring - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - org.springframework - spring-core - 2.5.5 - - - - org.springframework - spring-beans - 2.5.5 - - - - org.springframework - spring-context - 2.5.5 - - - - junit - junit - 4.5 - test - - - - - ${artifactId} - - - diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java deleted file mode 100644 index 833cc50f71..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - -import org.oasisopen.sca.annotation.Service; - -/** - * This class implements the StockQuote service. - */ -@Service(StockQuoteService.class) -public class StockQuoteImpl implements StockQuoteService { - - public double getQuote(String symbol) { - double price = 104.0 + Math.random(); - price = ((int)(price * 100)) / 100.0; - - System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); - - return price; - } - -} diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java deleted file mode 100644 index d6db2bd182..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/StockQuoteService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * This is the business interface of the StockQuote service. - */ -@Remotable -public interface StockQuoteService { - - public double getQuote(String symbol); -} diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java deleted file mode 100644 index 643f9a187c..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/SCAApplicationContextProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package bigbank.stockquote.server; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -public class SCAApplicationContextProvider implements ApplicationContextAware { - - private static ApplicationContext ctx; - - public void setApplicationContext(ApplicationContext appContext) throws BeansException { - // Wiring the ApplicationContext into a static method - ctx = appContext; - } - - public static ApplicationContext getApplicationContext() { - return ctx; - } -} diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java b/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java deleted file mode 100644 index da96f29b0c..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/java/bigbank/stockquote/server/StockQuoteServer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote.server; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.springframework.context.ApplicationContext; - -/** - * This server program shows how to bootstrap SCA from a simple J2SE program - * and start it which activates the StockQuote Web service endpoint. - */ -public class StockQuoteServer { - - public static void main(String[] args) throws Exception { - long timeout = -1L; - if (args.length > 0) { - timeout = Long.parseLong(args[0]); - } - - System.out.println("Starting the Sample SCA StockQuote Service..."); - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("StockQuote.composite", StockQuoteServer.class.getClassLoader()); - node.start(); - - // Method 1: To access the Spring Application Context instance - ApplicationContext ctx = SCAApplicationContextProvider.getApplicationContext(); - if (ctx.containsBean("StockQuoteServiceBean")) - System.out.println("StockQuoteServiceBean is now available for use..."); - - if (timeout < 0) { - System.out.println("Press Enter to Exit..."); - System.in.read(); - } else { - Thread.sleep(timeout); - } - - node.stop(); - System.out.println("Bye"); - } -} diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml b/java/sca/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml deleted file mode 100644 index 87dd006b5a..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/resources/META-INF/spring/StockQuoteService-context.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite b/java/sca/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite deleted file mode 100644 index 06544c6883..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/main/resources/StockQuote.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java b/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java deleted file mode 100644 index 4b36d0694d..0000000000 --- a/java/sca/samples/spring-bigbank-stockquote/src/test/java/bigbank/stockquote/StockQuoteServiceTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package bigbank.stockquote; - -import junit.framework.TestCase; -import bigbank.stockquote.server.StockQuoteServer; - -/** - * Tests out the big bank service - * - */ -public class StockQuoteServiceTestCase extends TestCase { - - public void testServer() throws Exception { - StockQuoteServer.main(new String[] {"1000"}); - } -} diff --git a/java/sca/samples/store-distributed/README b/java/sca/samples/store-distributed/README deleted file mode 100644 index 46e71bf51e..0000000000 --- a/java/sca/samples/store-distributed/README +++ /dev/null @@ -1,28 +0,0 @@ -Store Sample -====================================== - -This is a sample store scenario that is used as a getting started guide -for Tuscany SCA. For detailed information, please see: - -http://tuscany.apache.org/getting-started-with-tuscany.html - -or - -http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as follows: - -cd store -ant compile - -and then, to run: - -ant run - -Once the store application is running use your browser to visit the following -URL: - -http://localhost:8080/store/ diff --git a/java/sca/samples/store-distributed/build.xml b/java/sca/samples/store-distributed/build.xml deleted file mode 100644 index 652afc3570..0000000000 --- a/java/sca/samples/store-distributed/build.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/cloud.composite b/java/sca/samples/store-distributed/cloud.composite deleted file mode 100644 index 7bd13d5b6f..0000000000 --- a/java/sca/samples/store-distributed/cloud.composite +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/store-distributed/domain.composite b/java/sca/samples/store-distributed/domain.composite deleted file mode 100644 index 6898c454af..0000000000 --- a/java/sca/samples/store-distributed/domain.composite +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - diff --git a/java/sca/samples/store-distributed/pom.xml b/java/sca/samples/store-distributed/pom.xml deleted file mode 100644 index e812ae0b10..0000000000 --- a/java/sca/samples/store-distributed/pom.xml +++ /dev/null @@ -1,119 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../pom.xml - - sample-store-distributed - Apache Tuscany SCA Getting Started Online Store Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-domain-manager - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-widget-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/store-distributed/src/main/java/node/LaunchDomain.java b/java/sca/samples/store-distributed/src/main/java/node/LaunchDomain.java deleted file mode 100644 index dd19f6b49b..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/node/LaunchDomain.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package node; - -import org.apache.tuscany.sca.node.launcher.DomainManagerLauncher; - -/** - * This server program that loads a composite to provide simple registry function. - * This server can be replaced with any registry that is appropriate but the components - * in each node that talk to the registry should be replaced also. - */ -public class LaunchDomain { - public static void main(String[] args) throws Exception { - DomainManagerLauncher.main(args); - } - -} diff --git a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java b/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java deleted file mode 100644 index 9016e515fb..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeA.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchStoreNodeA { - public static void main(String[] args) throws Exception { - NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeA"}); - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java b/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java deleted file mode 100644 index 2b387aec82..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeB.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchStoreNodeB { - public static void main(String[] args) throws Exception { - NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeB"}); - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java b/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java deleted file mode 100644 index fb138e484f..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/node/LaunchStoreNodeC.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package node; - -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchStoreNodeC { - public static void main(String[] args) throws Exception { - NodeLauncher.main(new String[] {"http://localhost:9990/node-config/NodeC"}); - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/Cart.java b/java/sca/samples/store-distributed/src/main/java/services/Cart.java deleted file mode 100644 index 3fb5439bc3..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/Cart.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.apache.tuscany.sca.data.collection.Collection; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Cart extends Collection { - -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/Catalog.java b/java/sca/samples/store-distributed/src/main/java/services/Catalog.java deleted file mode 100644 index b5e504fe11..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/Catalog.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Catalog { - Item[] get(); -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverter.java b/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverter.java deleted file mode 100644 index a064f3dd69..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CurrencyConverter { - public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); - - public String getCurrencySymbol(String currencyCode); -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java b/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java deleted file mode 100644 index c354aed447..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/CurrencyConverterImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -public class CurrencyConverterImpl implements CurrencyConverter { - public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { - if (toCurrencyCode.equals("USD")) - return amount; - else if (toCurrencyCode.equals("EUR")) - return ((double)Math.round(amount * 0.7256 * 100)) /100; - return 0; - } - - public String getCurrencySymbol(String currencyCode) { - if (currencyCode.equals("USD")) - return "$"; - else if (currencyCode.equals("EUR")) - return "E"; //"€"; - return "?"; - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java b/java/sca/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java deleted file mode 100644 index d132a24b00..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/FruitsCatalogImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.util.ArrayList; -import java.util.List; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -public class FruitsCatalogImpl implements Catalog { - - @Property - public String currencyCode = "USD"; - - @Reference - public CurrencyConverter currencyConverter; - - private List catalog = new ArrayList(); - - @Init - public void init() { - String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); - catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); - catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); - catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); - } - - public Item[] get() { - Item[] catalogArray = new Item[catalog.size()]; - catalog.toArray(catalogArray); - return catalogArray; - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/Item.java b/java/sca/samples/store-distributed/src/main/java/services/Item.java deleted file mode 100644 index 27abd4f016..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/Item.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - - -public class Item { - private String name; - private String price; - - public Item() { - } - - public Item(String name, String price) { - this.name = name; - this.price = price; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPrice() { - return price; - } - - public void setPrice(String price) { - this.price = price; - } - -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java b/java/sca/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java deleted file mode 100644 index 698614212d..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/ShoppingCartImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class ShoppingCartImpl implements Cart, Total { - - private Map cart; - - @Init - public void init() { - cart = new HashMap(); - } - - public Entry[] getAll() { - Entry[] entries = new Entry[cart.size()]; - int i = 0; - for (Map.Entry e: cart.entrySet()) { - entries[i++] = new Entry(e.getKey(), e.getValue()); - } - return entries; - } - - public Item get(String key) throws NotFoundException { - Item item = cart.get(key); - if (item == null) { - throw new NotFoundException(key); - } else { - return item; - } - } - - public String post(String key, Item item) { - if (key == null) { - key ="cart-" + UUID.randomUUID().toString(); - } - cart.put(key, item); - return key; - } - - public void put(String key, Item item) throws NotFoundException { - if (!cart.containsKey(key)) { - throw new NotFoundException(key); - } - cart.put(key, item); - } - - public void delete(String key) throws NotFoundException { - if (key == null || key.equals("")) { - cart.clear(); - } else { - Item item = cart.remove(key); - if (item == null) - throw new NotFoundException(key); - } - } - - public Entry[] query(String queryString) { - List> entries = new ArrayList>(); - if (queryString.startsWith("name=")) { - String name = queryString.substring(5); - for (Map.Entry e: cart.entrySet()) { - Item item = e.getValue(); - if (item.getName().equals(name)) { - entries.add(new Entry(e.getKey(), e.getValue())); - } - } - } - return entries.toArray(new Entry[entries.size()]); - } - - public String getTotal() { - double total = 0; - String currencySymbol = ""; - if (!cart.isEmpty()) { - Item item = cart.values().iterator().next(); - currencySymbol = item.getPrice().substring(0, 1); - } - for (Item item : cart.values()) { - total += Double.valueOf(item.getPrice().substring(1)); - } - return currencySymbol + String.valueOf(total); - } -} diff --git a/java/sca/samples/store-distributed/src/main/java/services/Total.java b/java/sca/samples/store-distributed/src/main/java/services/Total.java deleted file mode 100644 index b77cc1c7ac..0000000000 --- a/java/sca/samples/store-distributed/src/main/java/services/Total.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Total { - - String getTotal(); - -} diff --git a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeA.composite b/java/sca/samples/store-distributed/src/main/resources/cloud/NodeA.composite deleted file mode 100644 index f7bfd0fcb6..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeA.composite +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeB.composite b/java/sca/samples/store-distributed/src/main/resources/cloud/NodeB.composite deleted file mode 100644 index 187c5caf1c..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeB.composite +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeC.composite b/java/sca/samples/store-distributed/src/main/resources/cloud/NodeC.composite deleted file mode 100644 index 98113a3576..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/cloud/NodeC.composite +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml b/java/sca/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml deleted file mode 100644 index f165ee0e29..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeA/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeA/store.composite b/java/sca/samples/store-distributed/src/main/resources/nodeA/store.composite deleted file mode 100644 index 2ac608d43f..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeA/store.composite +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - USD - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml b/java/sca/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml deleted file mode 100644 index 0f8e76ccd7..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeB/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeB/store.composite b/java/sca/samples/store-distributed/src/main/resources/nodeB/store.composite deleted file mode 100644 index 062a7aa2cd..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeB/store.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml b/java/sca/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml deleted file mode 100644 index 15bab17c1a..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeC/META-INF/sca-contribution.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeC/store.composite b/java/sca/samples/store-distributed/src/main/resources/nodeC/store.composite deleted file mode 100644 index 5de310128d..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeC/store.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html b/java/sca/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html deleted file mode 100644 index 45604463d1..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/nodeC/uiservices/store.html +++ /dev/null @@ -1,162 +0,0 @@ - - - -Store - - - - - - - - -

Store

-
-

Catalog

-
-
-
- -
- -
- -

Your Shopping Cart

-
-
-
-
-
- - - (feed) -
-
- - diff --git a/java/sca/samples/store-distributed/src/main/resources/uiservices/store.html b/java/sca/samples/store-distributed/src/main/resources/uiservices/store.html deleted file mode 100644 index 45604463d1..0000000000 --- a/java/sca/samples/store-distributed/src/main/resources/uiservices/store.html +++ /dev/null @@ -1,162 +0,0 @@ - - - -Store - - - - - - - - -

Store

-
-

Catalog

-
-
-
- -
- -
- -

Your Shopping Cart

-
-
-
-
-
- - - (feed) -
-
- - diff --git a/java/sca/samples/store-distributed/store.png b/java/sca/samples/store-distributed/store.png deleted file mode 100644 index da413edeee..0000000000 Binary files a/java/sca/samples/store-distributed/store.png and /dev/null differ diff --git a/java/sca/samples/store-distributed/store.svg b/java/sca/samples/store-distributed/store.svg deleted file mode 100644 index 74f8ecd36d..0000000000 --- a/java/sca/samples/store-distributed/store.svg +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - store - ufs - - ShoppingCart - - CurrencyConverter - - - - - - - - - - CurrenyCode HTTP JSONRPC Atom - - Catalog - - - - diff --git a/java/sca/samples/store-distributed/workspace.xml b/java/sca/samples/store-distributed/workspace.xml deleted file mode 100644 index d6cb2bfc81..0000000000 --- a/java/sca/samples/store-distributed/workspace.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - diff --git a/java/sca/samples/store/README b/java/sca/samples/store/README deleted file mode 100644 index 46e71bf51e..0000000000 --- a/java/sca/samples/store/README +++ /dev/null @@ -1,28 +0,0 @@ -Store Sample -====================================== - -This is a sample store scenario that is used as a getting started guide -for Tuscany SCA. For detailed information, please see: - -http://tuscany.apache.org/getting-started-with-tuscany.html - -or - -http://tuscany.apache.org/getting-started-with-tuscany-using-tuscany-eclipse-plugin.html - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built using Ant as follows: - -cd store -ant compile - -and then, to run: - -ant run - -Once the store application is running use your browser to visit the following -URL: - -http://localhost:8080/store/ diff --git a/java/sca/samples/store/build.xml b/java/sca/samples/store/build.xml deleted file mode 100644 index 652afc3570..0000000000 --- a/java/sca/samples/store/build.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store/pom.xml b/java/sca/samples/store/pom.xml deleted file mode 100644 index d68563807a..0000000000 --- a/java/sca/samples/store/pom.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../pom.xml - - sample-store - Apache Tuscany SCA Getting Started Online Store Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-data-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-widget-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-atom-abdera - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-jsonrpc-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/store/src/main/java/launch/Launch.java b/java/sca/samples/store/src/main/java/launch/Launch.java deleted file mode 100644 index 801697abea..0000000000 --- a/java/sca/samples/store/src/main/java/launch/Launch.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package launch; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class Launch { - public static void main(String[] args) throws Exception { - System.out.println("Starting ..."); - SCADomain scaDomain = SCADomain.newInstance("store.composite"); - System.out.println("store.composite ready for big business !!!"); - System.in.read(); - System.out.println("Stopping ..."); - scaDomain.close(); - System.out.println(); - } -} diff --git a/java/sca/samples/store/src/main/java/services/Cart.java b/java/sca/samples/store/src/main/java/services/Cart.java deleted file mode 100644 index 3fb5439bc3..0000000000 --- a/java/sca/samples/store/src/main/java/services/Cart.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.apache.tuscany.sca.data.collection.Collection; -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Cart extends Collection { - -} diff --git a/java/sca/samples/store/src/main/java/services/Catalog.java b/java/sca/samples/store/src/main/java/services/Catalog.java deleted file mode 100644 index b5e504fe11..0000000000 --- a/java/sca/samples/store/src/main/java/services/Catalog.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Catalog { - Item[] get(); -} diff --git a/java/sca/samples/store/src/main/java/services/CurrencyConverter.java b/java/sca/samples/store/src/main/java/services/CurrencyConverter.java deleted file mode 100644 index a064f3dd69..0000000000 --- a/java/sca/samples/store/src/main/java/services/CurrencyConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CurrencyConverter { - public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); - - public String getCurrencySymbol(String currencyCode); -} diff --git a/java/sca/samples/store/src/main/java/services/CurrencyConverterImpl.java b/java/sca/samples/store/src/main/java/services/CurrencyConverterImpl.java deleted file mode 100644 index c354aed447..0000000000 --- a/java/sca/samples/store/src/main/java/services/CurrencyConverterImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -public class CurrencyConverterImpl implements CurrencyConverter { - public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { - if (toCurrencyCode.equals("USD")) - return amount; - else if (toCurrencyCode.equals("EUR")) - return ((double)Math.round(amount * 0.7256 * 100)) /100; - return 0; - } - - public String getCurrencySymbol(String currencyCode) { - if (currencyCode.equals("USD")) - return "$"; - else if (currencyCode.equals("EUR")) - return "E"; //"€"; - return "?"; - } -} diff --git a/java/sca/samples/store/src/main/java/services/FruitsCatalogImpl.java b/java/sca/samples/store/src/main/java/services/FruitsCatalogImpl.java deleted file mode 100644 index d132a24b00..0000000000 --- a/java/sca/samples/store/src/main/java/services/FruitsCatalogImpl.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.util.ArrayList; -import java.util.List; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; - -public class FruitsCatalogImpl implements Catalog { - - @Property - public String currencyCode = "USD"; - - @Reference - public CurrencyConverter currencyConverter; - - private List catalog = new ArrayList(); - - @Init - public void init() { - String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); - catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); - catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); - catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); - } - - public Item[] get() { - Item[] catalogArray = new Item[catalog.size()]; - catalog.toArray(catalogArray); - return catalogArray; - } -} diff --git a/java/sca/samples/store/src/main/java/services/Item.java b/java/sca/samples/store/src/main/java/services/Item.java deleted file mode 100644 index 27abd4f016..0000000000 --- a/java/sca/samples/store/src/main/java/services/Item.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - - -public class Item { - private String name; - private String price; - - public Item() { - } - - public Item(String name, String price) { - this.name = name; - this.price = price; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPrice() { - return price; - } - - public void setPrice(String price) { - this.price = price; - } - -} diff --git a/java/sca/samples/store/src/main/java/services/ShoppingCartImpl.java b/java/sca/samples/store/src/main/java/services/ShoppingCartImpl.java deleted file mode 100644 index 698614212d..0000000000 --- a/java/sca/samples/store/src/main/java/services/ShoppingCartImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.data.collection.Entry; -import org.apache.tuscany.sca.data.collection.NotFoundException; -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class ShoppingCartImpl implements Cart, Total { - - private Map cart; - - @Init - public void init() { - cart = new HashMap(); - } - - public Entry[] getAll() { - Entry[] entries = new Entry[cart.size()]; - int i = 0; - for (Map.Entry e: cart.entrySet()) { - entries[i++] = new Entry(e.getKey(), e.getValue()); - } - return entries; - } - - public Item get(String key) throws NotFoundException { - Item item = cart.get(key); - if (item == null) { - throw new NotFoundException(key); - } else { - return item; - } - } - - public String post(String key, Item item) { - if (key == null) { - key ="cart-" + UUID.randomUUID().toString(); - } - cart.put(key, item); - return key; - } - - public void put(String key, Item item) throws NotFoundException { - if (!cart.containsKey(key)) { - throw new NotFoundException(key); - } - cart.put(key, item); - } - - public void delete(String key) throws NotFoundException { - if (key == null || key.equals("")) { - cart.clear(); - } else { - Item item = cart.remove(key); - if (item == null) - throw new NotFoundException(key); - } - } - - public Entry[] query(String queryString) { - List> entries = new ArrayList>(); - if (queryString.startsWith("name=")) { - String name = queryString.substring(5); - for (Map.Entry e: cart.entrySet()) { - Item item = e.getValue(); - if (item.getName().equals(name)) { - entries.add(new Entry(e.getKey(), e.getValue())); - } - } - } - return entries.toArray(new Entry[entries.size()]); - } - - public String getTotal() { - double total = 0; - String currencySymbol = ""; - if (!cart.isEmpty()) { - Item item = cart.values().iterator().next(); - currencySymbol = item.getPrice().substring(0, 1); - } - for (Item item : cart.values()) { - total += Double.valueOf(item.getPrice().substring(1)); - } - return currencySymbol + String.valueOf(total); - } -} diff --git a/java/sca/samples/store/src/main/java/services/Total.java b/java/sca/samples/store/src/main/java/services/Total.java deleted file mode 100644 index b77cc1c7ac..0000000000 --- a/java/sca/samples/store/src/main/java/services/Total.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package services; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface Total { - - String getTotal(); - -} diff --git a/java/sca/samples/store/src/main/resources/store.composite b/java/sca/samples/store/src/main/resources/store.composite deleted file mode 100644 index 571678839d..0000000000 --- a/java/sca/samples/store/src/main/resources/store.composite +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - USD - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/store/src/main/resources/uiservices/store.html b/java/sca/samples/store/src/main/resources/uiservices/store.html deleted file mode 100644 index 45604463d1..0000000000 --- a/java/sca/samples/store/src/main/resources/uiservices/store.html +++ /dev/null @@ -1,162 +0,0 @@ - - - -Store - - - - - - - - -

Store

-
-

Catalog

-
-
-
- -
- -
- -

Your Shopping Cart

-
-
-
-
-
- - - (feed) -
-
- - diff --git a/java/sca/samples/store/store.png b/java/sca/samples/store/store.png deleted file mode 100644 index da413edeee..0000000000 Binary files a/java/sca/samples/store/store.png and /dev/null differ diff --git a/java/sca/samples/store/store.svg b/java/sca/samples/store/store.svg deleted file mode 100644 index 74f8ecd36d..0000000000 --- a/java/sca/samples/store/store.svg +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - store - ufs - - ShoppingCart - - CurrencyConverter - - - - - - - - - - CurrenyCode HTTP JSONRPC Atom - - Catalog - - - - diff --git a/java/sca/samples/supplychain/README b/java/sca/samples/supplychain/README deleted file mode 100644 index ea4493fdd4..0000000000 --- a/java/sca/samples/supplychain/README +++ /dev/null @@ -1,101 +0,0 @@ -SupplyChain Sample -================== - -This sample demonstrates SCA components using the asynchronous API. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-supplychain.jar supplychain.SupplyChainClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-supplychain.jar supplychain.SupplyChainClient - - -Sample Overview ---------------- - -The sample provides a Customer service with a purchaseGoods operation -and a notifyShipment operation annotated with the SCA @OneWay annotation. -The SupplyChainClient exercises this interface by calling the -purchaseGoods operation. This results in messages passing to -the Retailer, Warehouse, and Shipper components and the result returned -to the Customer service on a separate callback thread. - -supplychain/ - src/ - main/ - java/ - supplychain/ - Customer.java - Defines the Java interface implemented - by the Customer component - CustomerComponentImpl.java - Implements the SCA Customer component - Retailer.java - Defines the Java interface implemented - by the Retailer component - RetailerComponentImpl.java - Implements the SCA RetailerComponent component - Shipper.java - Defines the Java interface implemented - by the Shipper component - ShipperComponentImpl.java - Implements the SCA ShipperComponent component - SupplyChainClient.java - SupplyChainClient.java loads SCA runtime - Warehouse.java - Defines the Java interface implemented - by the Warehouse component - WarehouseComponentImpl.java - Implements the SCA WarehouseComponent component - - resources/ - supplychain.composite - the SCA assembly for this sample - test/ - java/ - supplychain/ - SupplyChainClientTestCase.java - JUnit test case - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant as -follows - -cd supplychain -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] Main thread Thread[main,5,main] - [java] Main thread sleeping ... - [java] Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped - -Building And Running The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built and run -using Maven as follows. - -cd supplychain -mvn - -You should see the following output from the test phase. - -------------------------------------------------------- - T E S T S -------------------------------------------------------- -Running supplychain.SupplyChainClientTestCase -Main thread Thread[main,5,main] -Sleeping ... -Work thread Thread[pool-1-thread-1,5,main] - Order, submitted, fulfilled, shipped -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.625 sec - -Results : - -Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 - -This shows that the Junit test cases have run successfully. \ No newline at end of file diff --git a/java/sca/samples/supplychain/build.xml b/java/sca/samples/supplychain/build.xml deleted file mode 100644 index 506180b8b1..0000000000 --- a/java/sca/samples/supplychain/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/supplychain/pom.xml b/java/sca/samples/supplychain/pom.xml deleted file mode 100644 index 2e85d79793..0000000000 --- a/java/sca/samples/supplychain/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-supplychain - Apache Tuscany SCA Supply Chain Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/Customer.java b/java/sca/samples/supplychain/src/main/java/supplychain/Customer.java deleted file mode 100644 index 6c19a1108e..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/Customer.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.oasisopen.sca.annotation.OneWay; - -/** - * This is the business interface of the Customer service component. - */ -public interface Customer { - - public void purchaseGoods(); - - @OneWay - public void notifyShipment(String order); - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/java/sca/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java deleted file mode 100644 index 0323cebe11..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.oasisopen.sca.annotation.Reference; - -/** - * This class implements the Customer service component. - */ -public class CustomerComponentImpl implements Customer { - - private Retailer retailer; - - @Reference - public void setRetailer(Retailer retailer) { - this.retailer = retailer; - } - - public void purchaseGoods() { - retailer.submitOrder("Order"); - } - - public void notifyShipment(String order) { - System.out.print("Work thread " + Thread.currentThread() + " - "); - System.out.println(order); - } - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/Retailer.java b/java/sca/samples/supplychain/src/main/java/supplychain/Retailer.java deleted file mode 100644 index 1add63fb4e..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/Retailer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -/** - * This is the business interface of the Retailer service component. - */ -public interface Retailer { - - public void submitOrder(String order); - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/java/sca/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java deleted file mode 100644 index 809e2b7b89..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.oasisopen.sca.annotation.Reference; - -/** - * This class implements the Customer service component. - */ -public class RetailerComponentImpl implements Retailer { - - private Warehouse warehouse; - - @Reference - public void setWarehouse(Warehouse warehouse) { - this.warehouse = warehouse; - } - - public void submitOrder(String order) { - warehouse.fulfillOrder(order + ", submitted"); - } - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/Shipper.java b/java/sca/samples/supplychain/src/main/java/supplychain/Shipper.java deleted file mode 100644 index d4d49a922b..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/Shipper.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -/** - * This is the business interface of the Shipper service component. - */ -public interface Shipper { - - public void processShipment(String order); - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/java/sca/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java deleted file mode 100644 index 59513eca5d..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.oasisopen.sca.annotation.Reference; - -/** - * This class implements the Warehouse service component. - */ -public class ShipperComponentImpl implements Shipper { - - private Customer customer; - - @Reference - public void setCustomer(Customer customer) { - this.customer = customer; - } - - public void processShipment(String order) { - customer.notifyShipment(order + ", shipped"); - } - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/java/sca/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java deleted file mode 100644 index 7072f582d1..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate a Customer service component and invoke it. - */ -public class SupplyChainClient { - - public static final void main(String[] args) throws Exception { - SCADomain scaDomain = SCADomain.newInstance("supplychain.composite"); - Customer customer = scaDomain.getService(Customer.class, "CustomerComponent"); - - System.out.println("Main thread " + Thread.currentThread()); - customer.purchaseGoods(); - System.out.println("Main thread sleeping ..."); - Thread.sleep(1000); - - scaDomain.close(); - } -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/Warehouse.java b/java/sca/samples/supplychain/src/main/java/supplychain/Warehouse.java deleted file mode 100644 index 0be499f569..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/Warehouse.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -/** - * This is the business interface of the Warehouse service component. - */ -public interface Warehouse { - - public void fulfillOrder(String order); - -} diff --git a/java/sca/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/java/sca/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java deleted file mode 100644 index ff4f5e62eb..0000000000 --- a/java/sca/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import org.oasisopen.sca.annotation.Reference; - -/** - * This class implements the Warehouse service component. - */ -public class WarehouseComponentImpl implements Warehouse { - - private Shipper shipper; - - @Reference - public void setShipper(Shipper shipper) { - this.shipper = shipper; - } - - public void fulfillOrder(String order) { - shipper.processShipment(order + ", fulfilled"); - } - -} diff --git a/java/sca/samples/supplychain/src/main/resources/supplychain.composite b/java/sca/samples/supplychain/src/main/resources/supplychain.composite deleted file mode 100644 index 301efcaf1f..0000000000 --- a/java/sca/samples/supplychain/src/main/resources/supplychain.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/java/sca/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java deleted file mode 100644 index 88e0eb7ab8..0000000000 --- a/java/sca/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package supplychain; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program shows how to create an SCA runtime, start it, - * locate a the Customer service component and invoke it. - */ -public class SupplyChainClientTestCase extends TestCase { - - private SCADomain scaDomain; - private Customer customer; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("supplychain.composite"); - customer = scaDomain.getService(Customer.class, "CustomerComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void test() throws Exception { - - System.out.println("Main thread " + Thread.currentThread()); - customer.purchaseGoods(); - System.out.println("Sleeping ..."); - Thread.sleep(1000); - } -} diff --git a/java/sca/samples/supplychain/supplychain.png b/java/sca/samples/supplychain/supplychain.png deleted file mode 100644 index 51a384e827..0000000000 Binary files a/java/sca/samples/supplychain/supplychain.png and /dev/null differ diff --git a/java/sca/samples/supplychain/supplychain.svg b/java/sca/samples/supplychain/supplychain.svg deleted file mode 100644 index f72e77acab..0000000000 --- a/java/sca/samples/supplychain/supplychain.svg +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - supplychain - - CustomerComponent - - - RetailerComponent - - - WharehouseComponent - - - ShipperComponent - - - - - - - diff --git a/java/sca/samples/web-resource/README b/java/sca/samples/web-resource/README deleted file mode 100644 index 56bffba6a3..0000000000 --- a/java/sca/samples/web-resource/README +++ /dev/null @@ -1,76 +0,0 @@ -Web Resource Component Sample -====================================== -This sample demonstrates an SCA Web resource component. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-web-resource.jar web.resource.SampleServer - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-web-resource.jar web.resource.SampleServer - -Now the server is started you can point your Web browser to the URL of the Web resource. - -Sample Overview ---------------- -The sample provides a single component exposing a Web resource. - -web-resource/ - src/ - main/ - java/ - web/resource/ - SampleServer.java - starts the SCA Runtime and - deploys the WebResource.composite - resources/ - myContent/ - index.html - a Web HTML resource - WebResource.composite - the SCA assembly for this sample - web-resource.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd web-resource -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/* - [java] Sample server started (press enter to shutdown) - [java] - [java] To get the Web resource, point your Web browser to the following add -ress: - [java] http://localhost:8080/myWeb/index.html - [java] - -As this point the Web resource is exposed by a web server started automatically -by the SCA runtime. To stop the server just press enter. - -Building The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built using -Maven as follows. - -cd web-resource -mvn - diff --git a/java/sca/samples/web-resource/build.xml b/java/sca/samples/web-resource/build.xml deleted file mode 100644 index 5f6b6091e7..0000000000 --- a/java/sca/samples/web-resource/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/web-resource/pom.xml b/java/sca/samples/web-resource/pom.xml deleted file mode 100644 index eaa6269819..0000000000 --- a/java/sca/samples/web-resource/pom.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-web-resource - Apache Tuscany SCA Web Resource Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-resource-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-http-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-tomcat - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - ${artifactId} - - - diff --git a/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java b/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java deleted file mode 100644 index 9410de08c4..0000000000 --- a/java/sca/samples/web-resource/src/main/java/web/resource/SampleServer.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package web.resource; - -import java.io.IOException; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -public class SampleServer { - public static void main(String[] args) throws Exception { - - SCADomain scaDomain = SCADomain.newInstance("WebResource.composite"); - - try { - System.out.println("Sample server started (press enter to shutdown)"); - System.out.println(); - System.out.println("To get the Web resource, point your Web browser to the following address:"); - System.out.println("http://localhost:8080/myWeb/index.html"); - System.out.println(); - System.in.read(); - } catch (IOException e) { - e.printStackTrace(); - } - - scaDomain.close(); - System.out.println("Sample server stopped"); - } -} diff --git a/java/sca/samples/web-resource/src/main/resources/WebResource.composite b/java/sca/samples/web-resource/src/main/resources/WebResource.composite deleted file mode 100644 index 4536136a8b..0000000000 --- a/java/sca/samples/web-resource/src/main/resources/WebResource.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/web-resource/src/main/resources/myContent/index.html b/java/sca/samples/web-resource/src/main/resources/myContent/index.html deleted file mode 100644 index 55de048373..0000000000 --- a/java/sca/samples/web-resource/src/main/resources/myContent/index.html +++ /dev/null @@ -1,49 +0,0 @@ - - - - Tuscany Sample Web Resource - - - -

A Sample Web Resource

- -

Tuscany allows you to publish Web resources using SCA components declared with an - <implementation.resource> component implementation type and made available - to HTTP clients using a <binding.http> binding.

- -

Here is the SCA composite that publishes this page:

- -
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
-  targetNamespace="http://web"
-  name="WebResource">
-
-  <component name="myWeb">
-    <implementation.resource location="myContent"/>
-    <service name="Resource">
-      <binding.http/>
-    </service>
-  </component>      
-
-</composite>
-  	
- - - diff --git a/java/sca/samples/web-resource/web-resource.png b/java/sca/samples/web-resource/web-resource.png deleted file mode 100644 index 7259447b65..0000000000 Binary files a/java/sca/samples/web-resource/web-resource.png and /dev/null differ diff --git a/java/sca/samples/web-resource/web-resource.svg b/java/sca/samples/web-resource/web-resource.svg deleted file mode 100644 index 0d1257316c..0000000000 --- a/java/sca/samples/web-resource/web-resource.svg +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - WebResource - - - myWeb - implementation.resource - - File System - ./myContent /index.html - - binding.http - - diff --git a/java/sca/samples/zipcode-jaxws/LICENSE b/java/sca/samples/zipcode-jaxws/LICENSE deleted file mode 100644 index 6e529a25c4..0000000000 --- a/java/sca/samples/zipcode-jaxws/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - diff --git a/java/sca/samples/zipcode-jaxws/NOTICE b/java/sca/samples/zipcode-jaxws/NOTICE deleted file mode 100644 index 51042eab05..0000000000 --- a/java/sca/samples/zipcode-jaxws/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2009 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/java/sca/samples/zipcode-jaxws/README b/java/sca/samples/zipcode-jaxws/README deleted file mode 100644 index 12f81543f0..0000000000 --- a/java/sca/samples/zipcode-jaxws/README +++ /dev/null @@ -1,72 +0,0 @@ -ZipCode JAX-WS Sample -====================================== -This sample demonstrates how to access an existing web service using JAX-WS/JAXB generated java interfaces/classes. - -The README in the samples directory (the directory above this) provides -general instructions about building and running samples. Take a look there -first. - -If you just want to run it to see what happens open a command prompt, navigate -to this sample directory and do: - -ant run - -OR if you don't have ant, on Windows do - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-zipcode-jaxws.jar zipcode.ZipCodeClient - -and on *nix do - -java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-zipcode-jaxws.jar zipcode.ZipCodeClient - - -Sample Overview ---------------- -The sample provides a single component exposing a Web resource. - -zipcode-jaxws/ - src/ - main/ - java/ - - resources/ - ZipCode.composite - the SCA assembly for this sample - zipcode-jaxws.png - a pictorial representation of the - sample .composite file - build.xml - the Ant build file - pom.xml - the Maven build file - - -Building And Running The Sample Using Ant ------------------------------------------ -With the binary distribution the sample can be built and run using Ant using the -following commands - -cd zipcode-jaxws -ant compile -ant run - -You should see the following output from the run target. - -run: - [java] 14-Jan-2008 14:28:07 org.apache.tuscany.sca.http.jetty.JettyServer a -ddServletMapping - [java] INFO: Added Servlet mapping: http://L3AW203:8080/myWeb/* - [java] Sample server started (press enter to shutdown) - [java] - [java] To get the Web resource, point your Web browser to the following add -ress: - [java] http://localhost:8080/myWeb/index.html - [java] - -As this point the Web resource is exposed by a web server started automatically -by the SCA runtime. To stop the server just press enter. - -Building The Sample Using Maven -------------------------------------------- -With either the binary or source distributions the sample can be built using -Maven as follows. - -cd zipcode-jaxws -mvn - diff --git a/java/sca/samples/zipcode-jaxws/build.xml b/java/sca/samples/zipcode-jaxws/build.xml deleted file mode 100644 index 85caf5954e..0000000000 --- a/java/sca/samples/zipcode-jaxws/build.xml +++ /dev/null @@ -1,68 +0,0 @@ - - -]> - - - &buildDependency; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/samples/zipcode-jaxws/pom.xml b/java/sca/samples/zipcode-jaxws/pom.xml deleted file mode 100644 index 686b948d03..0000000000 --- a/java/sca/samples/zipcode-jaxws/pom.xml +++ /dev/null @@ -1,245 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../../pom.xml - - sample-zipcode-jaxws - jar - Apache Tuscany SCA US Zip Code JAX-WS Sample - Apache Tuscany SCA US Zip Code JAX-WS Sample - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.5 - test - - - - - - - java.net - java.net Maven 1.x Repository - http://download.java.net/maven/1 - legacy - - - java.net2 - java.net Maven 2.x Repository - http://download.java.net/maven/2 - - - - - - java.net2 - java.net Maven 2.x Repository - http://download.java.net/maven/2 - - - - - - ${artifactId} - - - - org.apache.maven.plugins - maven-antrun-plugin - 1.1 - - - - install-wsdl - validate - - run - - - - - - - - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - location.LocationClient - true - - - generate - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - -Djava.endorsed.dirs=target/endorsed - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy - generate-sources - - copy - - - - - javax.xml.ws - jaxws-api - 2.1 - jar - - - javax.xml.bind - jaxb-api - 2.1 - jar - - - ${project.build.directory}/endorsed - false - true - - - - - - - - - - diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java deleted file mode 100644 index 8c9a48bf40..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCode.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="USAreaCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "usAreaCode" -}) -@XmlRootElement(name = "GetInfoByAreaCode") -public class GetInfoByAreaCode { - - @XmlElement(name = "USAreaCode") - protected String usAreaCode; - - /** - * Gets the value of the usAreaCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUSAreaCode() { - return usAreaCode; - } - - /** - * Sets the value of the usAreaCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUSAreaCode(String value) { - this.usAreaCode = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java deleted file mode 100644 index 93847c8809..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByAreaCodeResponse.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetInfoByAreaCodeResult" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <any/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getInfoByAreaCodeResult" -}) -@XmlRootElement(name = "GetInfoByAreaCodeResponse") -public class GetInfoByAreaCodeResponse { - - @XmlElement(name = "GetInfoByAreaCodeResult") - protected GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getInfoByAreaCodeResult; - - /** - * Gets the value of the getInfoByAreaCodeResult property. - * - * @return - * possible object is - * {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } - * - */ - public GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getGetInfoByAreaCodeResult() { - return getInfoByAreaCodeResult; - } - - /** - * Sets the value of the getInfoByAreaCodeResult property. - * - * @param value - * allowed object is - * {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } - * - */ - public void setGetInfoByAreaCodeResult(GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult value) { - this.getInfoByAreaCodeResult = value; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <any/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "content" - }) - public static class GetInfoByAreaCodeResult { - - @XmlMixed - @XmlAnyElement(lax = true) - protected List content; - - /** - * Gets the value of the content property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the content property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getContent().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * {@link Object } - * - * - */ - public List getContent() { - if (content == null) { - content = new ArrayList(); - } - return this.content; - } - - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java deleted file mode 100644 index cf9276d417..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCity.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="USCity" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "usCity" -}) -@XmlRootElement(name = "GetInfoByCity") -public class GetInfoByCity { - - @XmlElement(name = "USCity") - protected String usCity; - - /** - * Gets the value of the usCity property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUSCity() { - return usCity; - } - - /** - * Sets the value of the usCity property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUSCity(String value) { - this.usCity = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java deleted file mode 100644 index 9dc0e41b2b..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByCityResponse.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetInfoByCityResult" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <any/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getInfoByCityResult" -}) -@XmlRootElement(name = "GetInfoByCityResponse") -public class GetInfoByCityResponse { - - @XmlElement(name = "GetInfoByCityResult") - protected GetInfoByCityResponse.GetInfoByCityResult getInfoByCityResult; - - /** - * Gets the value of the getInfoByCityResult property. - * - * @return - * possible object is - * {@link GetInfoByCityResponse.GetInfoByCityResult } - * - */ - public GetInfoByCityResponse.GetInfoByCityResult getGetInfoByCityResult() { - return getInfoByCityResult; - } - - /** - * Sets the value of the getInfoByCityResult property. - * - * @param value - * allowed object is - * {@link GetInfoByCityResponse.GetInfoByCityResult } - * - */ - public void setGetInfoByCityResult(GetInfoByCityResponse.GetInfoByCityResult value) { - this.getInfoByCityResult = value; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <any/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "content" - }) - public static class GetInfoByCityResult { - - @XmlMixed - @XmlAnyElement(lax = true) - protected List content; - - /** - * Gets the value of the content property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the content property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getContent().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * {@link Object } - * - * - */ - public List getContent() { - if (content == null) { - content = new ArrayList(); - } - return this.content; - } - - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java deleted file mode 100644 index 48be94b14a..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByState.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="USState" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "usState" -}) -@XmlRootElement(name = "GetInfoByState") -public class GetInfoByState { - - @XmlElement(name = "USState") - protected String usState; - - /** - * Gets the value of the usState property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUSState() { - return usState; - } - - /** - * Sets the value of the usState property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUSState(String value) { - this.usState = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java deleted file mode 100644 index 1645e11ca2..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByStateResponse.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetInfoByStateResult" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <any/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getInfoByStateResult" -}) -@XmlRootElement(name = "GetInfoByStateResponse") -public class GetInfoByStateResponse { - - @XmlElement(name = "GetInfoByStateResult") - protected GetInfoByStateResponse.GetInfoByStateResult getInfoByStateResult; - - /** - * Gets the value of the getInfoByStateResult property. - * - * @return - * possible object is - * {@link GetInfoByStateResponse.GetInfoByStateResult } - * - */ - public GetInfoByStateResponse.GetInfoByStateResult getGetInfoByStateResult() { - return getInfoByStateResult; - } - - /** - * Sets the value of the getInfoByStateResult property. - * - * @param value - * allowed object is - * {@link GetInfoByStateResponse.GetInfoByStateResult } - * - */ - public void setGetInfoByStateResult(GetInfoByStateResponse.GetInfoByStateResult value) { - this.getInfoByStateResult = value; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <any/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "content" - }) - public static class GetInfoByStateResult { - - @XmlMixed - @XmlAnyElement(lax = true) - protected List content; - - /** - * Gets the value of the content property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the content property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getContent().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * {@link Object } - * - * - */ - public List getContent() { - if (content == null) { - content = new ArrayList(); - } - return this.content; - } - - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java deleted file mode 100644 index 45c948b4b4..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIP.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="USZip" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "usZip" -}) -@XmlRootElement(name = "GetInfoByZIP") -public class GetInfoByZIP { - - @XmlElement(name = "USZip") - protected String usZip; - - /** - * Gets the value of the usZip property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getUSZip() { - return usZip; - } - - /** - * Sets the value of the usZip property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setUSZip(String value) { - this.usZip = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java deleted file mode 100644 index 9e78dc6d0a..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/GetInfoByZIPResponse.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetInfoByZIPResult" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <any/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getInfoByZIPResult" -}) -@XmlRootElement(name = "GetInfoByZIPResponse") -public class GetInfoByZIPResponse { - - @XmlElement(name = "GetInfoByZIPResult") - protected GetInfoByZIPResponse.GetInfoByZIPResult getInfoByZIPResult; - - /** - * Gets the value of the getInfoByZIPResult property. - * - * @return - * possible object is - * {@link GetInfoByZIPResponse.GetInfoByZIPResult } - * - */ - public GetInfoByZIPResponse.GetInfoByZIPResult getGetInfoByZIPResult() { - return getInfoByZIPResult; - } - - /** - * Sets the value of the getInfoByZIPResult property. - * - * @param value - * allowed object is - * {@link GetInfoByZIPResponse.GetInfoByZIPResult } - * - */ - public void setGetInfoByZIPResult(GetInfoByZIPResponse.GetInfoByZIPResult value) { - this.getInfoByZIPResult = value; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <any/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "content" - }) - public static class GetInfoByZIPResult { - - @XmlMixed - @XmlAnyElement(lax = true) - protected List content; - - /** - * Gets the value of the content property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the content property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getContent().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link String } - * {@link Object } - * - * - */ - public List getContent() { - if (content == null) { - content = new ArrayList(); - } - return this.content; - } - - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java deleted file mode 100644 index ced83ff09a..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/ObjectFactory.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.xml.bind.annotation.XmlRegistry; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.example.uszip package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.example.uszip - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link GetInfoByCity } - * - */ - public GetInfoByCity createGetInfoByCity() { - return new GetInfoByCity(); - } - - /** - * Create an instance of {@link GetInfoByState } - * - */ - public GetInfoByState createGetInfoByState() { - return new GetInfoByState(); - } - - /** - * Create an instance of {@link GetInfoByZIPResponse.GetInfoByZIPResult } - * - */ - public GetInfoByZIPResponse.GetInfoByZIPResult createGetInfoByZIPResponseGetInfoByZIPResult() { - return new GetInfoByZIPResponse.GetInfoByZIPResult(); - } - - /** - * Create an instance of {@link GetInfoByStateResponse.GetInfoByStateResult } - * - */ - public GetInfoByStateResponse.GetInfoByStateResult createGetInfoByStateResponseGetInfoByStateResult() { - return new GetInfoByStateResponse.GetInfoByStateResult(); - } - - /** - * Create an instance of {@link GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult } - * - */ - public GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult createGetInfoByAreaCodeResponseGetInfoByAreaCodeResult() { - return new GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult(); - } - - /** - * Create an instance of {@link GetInfoByZIP } - * - */ - public GetInfoByZIP createGetInfoByZIP() { - return new GetInfoByZIP(); - } - - /** - * Create an instance of {@link GetInfoByAreaCodeResponse } - * - */ - public GetInfoByAreaCodeResponse createGetInfoByAreaCodeResponse() { - return new GetInfoByAreaCodeResponse(); - } - - /** - * Create an instance of {@link GetInfoByCityResponse } - * - */ - public GetInfoByCityResponse createGetInfoByCityResponse() { - return new GetInfoByCityResponse(); - } - - /** - * Create an instance of {@link GetInfoByStateResponse } - * - */ - public GetInfoByStateResponse createGetInfoByStateResponse() { - return new GetInfoByStateResponse(); - } - - /** - * Create an instance of {@link GetInfoByCityResponse.GetInfoByCityResult } - * - */ - public GetInfoByCityResponse.GetInfoByCityResult createGetInfoByCityResponseGetInfoByCityResult() { - return new GetInfoByCityResponse.GetInfoByCityResult(); - } - - /** - * Create an instance of {@link GetInfoByZIPResponse } - * - */ - public GetInfoByZIPResponse createGetInfoByZIPResponse() { - return new GetInfoByZIPResponse(); - } - - /** - * Create an instance of {@link GetInfoByAreaCode } - * - */ - public GetInfoByAreaCode createGetInfoByAreaCode() { - return new GetInfoByAreaCode(); - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java deleted file mode 100644 index 22493ba9b8..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZip.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.1.3-b02- - * Generated source version: 2.1 - * - */ -@WebServiceClient(name = "USZip", targetNamespace = "http://www.webserviceX.NET", wsdlLocation = "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl") -public class USZip - extends Service -{ - - private final static URL USZIP_WSDL_LOCATION; - private final static Logger logger = Logger.getLogger(com.example.uszip.USZip.class.getName()); - - static { - URL url = null; - try { - URL baseUrl; - baseUrl = com.example.uszip.USZip.class.getResource("."); - url = new URL(baseUrl, "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl"); - } catch (MalformedURLException e) { - logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/uszip.wsdl', retrying as a local file"); - logger.warning(e.getMessage()); - } - USZIP_WSDL_LOCATION = url; - } - - public USZip(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public USZip() { - super(USZIP_WSDL_LOCATION, new QName("http://www.webserviceX.NET", "USZip")); - } - - /** - * - * @return - * returns USZipSoap - */ - @WebEndpoint(name = "USZipSoap") - public USZipSoap getUSZipSoap() { - return super.getPort(new QName("http://www.webserviceX.NET", "USZipSoap"), USZipSoap.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns USZipSoap - */ - @WebEndpoint(name = "USZipSoap") - public USZipSoap getUSZipSoap(WebServiceFeature... features) { - return super.getPort(new QName("http://www.webserviceX.NET", "USZipSoap"), USZipSoap.class, features); - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java deleted file mode 100644 index 5ac370005f..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/USZipSoap.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.uszip; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -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- - * Generated source version: 2.1 - * - */ -@WebService(name = "USZipSoap", targetNamespace = "http://www.webserviceX.NET") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface USZipSoap { - - - /** - * Get State Code,City,Area Code,Time Zone,Zip Code by Zip Code - * - * @param usZip - * @return - * returns com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult - */ - @WebMethod(operationName = "GetInfoByZIP", action = "http://www.webserviceX.NET/GetInfoByZIP") - @WebResult(name = "GetInfoByZIPResult", targetNamespace = "http://www.webserviceX.NET") - @RequestWrapper(localName = "GetInfoByZIP", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByZIP") - @ResponseWrapper(localName = "GetInfoByZIPResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByZIPResponse") - public com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult getInfoByZIP( - @WebParam(name = "USZip", targetNamespace = "http://www.webserviceX.NET") - String usZip); - - /** - * Get State Code,City,Area Code,Time Zone,Zip Code by City - * - * @param usCity - * @return - * returns com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult - */ - @WebMethod(operationName = "GetInfoByCity", action = "http://www.webserviceX.NET/GetInfoByCity") - @WebResult(name = "GetInfoByCityResult", targetNamespace = "http://www.webserviceX.NET") - @RequestWrapper(localName = "GetInfoByCity", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByCity") - @ResponseWrapper(localName = "GetInfoByCityResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByCityResponse") - public com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult getInfoByCity( - @WebParam(name = "USCity", targetNamespace = "http://www.webserviceX.NET") - String usCity); - - /** - * Get State Code,City,Area Code,Time Zone,Zip Code by state - * - * @param usState - * @return - * returns com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult - */ - @WebMethod(operationName = "GetInfoByState", action = "http://www.webserviceX.NET/GetInfoByState") - @WebResult(name = "GetInfoByStateResult", targetNamespace = "http://www.webserviceX.NET") - @RequestWrapper(localName = "GetInfoByState", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByState") - @ResponseWrapper(localName = "GetInfoByStateResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByStateResponse") - public com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult getInfoByState( - @WebParam(name = "USState", targetNamespace = "http://www.webserviceX.NET") - String usState); - - /** - * Get State Code,City,Area Code,Time Zone,Zip Code by Area Code - * - * @param usAreaCode - * @return - * returns com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult - */ - @WebMethod(operationName = "GetInfoByAreaCode", action = "http://www.webserviceX.NET/GetInfoByAreaCode") - @WebResult(name = "GetInfoByAreaCodeResult", targetNamespace = "http://www.webserviceX.NET") - @RequestWrapper(localName = "GetInfoByAreaCode", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByAreaCode") - @ResponseWrapper(localName = "GetInfoByAreaCodeResponse", targetNamespace = "http://www.webserviceX.NET", className = "com.example.uszip.GetInfoByAreaCodeResponse") - public com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult getInfoByAreaCode( - @WebParam(name = "USAreaCode", targetNamespace = "http://www.webserviceX.NET") - String usAreaCode); - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java deleted file mode 100644 index d120f34ee5..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/uszip/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webserviceX.NET", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.example.uszip; diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java deleted file mode 100644 index 5385fb57be..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ArrayOfWeatherData.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for ArrayOfWeatherData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="ArrayOfWeatherData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="WeatherData" type="{http://www.webservicex.net}WeatherData" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ArrayOfWeatherData", propOrder = { - "weatherData" -}) -public class ArrayOfWeatherData { - - @XmlElement(name = "WeatherData") - protected List weatherData; - - /** - * Gets the value of the weatherData property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the weatherData property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getWeatherData().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link WeatherData } - * - * - */ - public List getWeatherData() { - if (weatherData == null) { - weatherData = new ArrayList(); - } - return this.weatherData; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java deleted file mode 100644 index 9eb205e75d..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceName.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="PlaceName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "placeName" -}) -@XmlRootElement(name = "GetWeatherByPlaceName") -public class GetWeatherByPlaceName { - - @XmlElement(name = "PlaceName") - protected String placeName; - - /** - * Gets the value of the placeName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPlaceName() { - return placeName; - } - - /** - * Sets the value of the placeName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPlaceName(String value) { - this.placeName = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java deleted file mode 100644 index e281509623..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByPlaceNameResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetWeatherByPlaceNameResult" type="{http://www.webservicex.net}WeatherForecasts"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getWeatherByPlaceNameResult" -}) -@XmlRootElement(name = "GetWeatherByPlaceNameResponse") -public class GetWeatherByPlaceNameResponse { - - @XmlElement(name = "GetWeatherByPlaceNameResult", required = true) - protected WeatherForecasts getWeatherByPlaceNameResult; - - /** - * Gets the value of the getWeatherByPlaceNameResult property. - * - * @return - * possible object is - * {@link WeatherForecasts } - * - */ - public WeatherForecasts getGetWeatherByPlaceNameResult() { - return getWeatherByPlaceNameResult; - } - - /** - * Sets the value of the getWeatherByPlaceNameResult property. - * - * @param value - * allowed object is - * {@link WeatherForecasts } - * - */ - public void setGetWeatherByPlaceNameResult(WeatherForecasts value) { - this.getWeatherByPlaceNameResult = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java deleted file mode 100644 index 08d4a70364..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCode.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="ZipCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "zipCode" -}) -@XmlRootElement(name = "GetWeatherByZipCode") -public class GetWeatherByZipCode { - - @XmlElement(name = "ZipCode") - protected String zipCode; - - /** - * Gets the value of the zipCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getZipCode() { - return zipCode; - } - - /** - * Sets the value of the zipCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setZipCode(String value) { - this.zipCode = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java deleted file mode 100644 index 9288f5332e..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/GetWeatherByZipCodeResponse.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="GetWeatherByZipCodeResult" type="{http://www.webservicex.net}WeatherForecasts"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "getWeatherByZipCodeResult" -}) -@XmlRootElement(name = "GetWeatherByZipCodeResponse") -public class GetWeatherByZipCodeResponse { - - @XmlElement(name = "GetWeatherByZipCodeResult", required = true) - protected WeatherForecasts getWeatherByZipCodeResult; - - /** - * Gets the value of the getWeatherByZipCodeResult property. - * - * @return - * possible object is - * {@link WeatherForecasts } - * - */ - public WeatherForecasts getGetWeatherByZipCodeResult() { - return getWeatherByZipCodeResult; - } - - /** - * Sets the value of the getWeatherByZipCodeResult property. - * - * @param value - * allowed object is - * {@link WeatherForecasts } - * - */ - public void setGetWeatherByZipCodeResult(WeatherForecasts value) { - this.getWeatherByZipCodeResult = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java deleted file mode 100644 index 0c4fdbcde1..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/ObjectFactory.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.example.weather package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _WeatherForecasts_QNAME = new QName("http://www.webservicex.net", "WeatherForecasts"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.example.weather - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link WeatherData } - * - */ - public WeatherData createWeatherData() { - return new WeatherData(); - } - - /** - * Create an instance of {@link GetWeatherByPlaceName } - * - */ - public GetWeatherByPlaceName createGetWeatherByPlaceName() { - return new GetWeatherByPlaceName(); - } - - /** - * Create an instance of {@link GetWeatherByPlaceNameResponse } - * - */ - public GetWeatherByPlaceNameResponse createGetWeatherByPlaceNameResponse() { - return new GetWeatherByPlaceNameResponse(); - } - - /** - * Create an instance of {@link GetWeatherByZipCodeResponse } - * - */ - public GetWeatherByZipCodeResponse createGetWeatherByZipCodeResponse() { - return new GetWeatherByZipCodeResponse(); - } - - /** - * Create an instance of {@link GetWeatherByZipCode } - * - */ - public GetWeatherByZipCode createGetWeatherByZipCode() { - return new GetWeatherByZipCode(); - } - - /** - * Create an instance of {@link WeatherForecasts } - * - */ - public WeatherForecasts createWeatherForecasts() { - return new WeatherForecasts(); - } - - /** - * Create an instance of {@link ArrayOfWeatherData } - * - */ - public ArrayOfWeatherData createArrayOfWeatherData() { - return new ArrayOfWeatherData(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link WeatherForecasts }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://www.webservicex.net", name = "WeatherForecasts") - public JAXBElement createWeatherForecasts(WeatherForecasts value) { - return new JAXBElement(_WeatherForecasts_QNAME, WeatherForecasts.class, null, value); - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java deleted file mode 100644 index a4ca6190b5..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherData.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WeatherData complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WeatherData">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Day" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="WeatherImage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="MaxTemperatureF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="MinTemperatureF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="MaxTemperatureC" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="MinTemperatureC" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WeatherData", propOrder = { - "day", - "weatherImage", - "maxTemperatureF", - "minTemperatureF", - "maxTemperatureC", - "minTemperatureC" -}) -public class WeatherData { - - @XmlElement(name = "Day") - protected String day; - @XmlElement(name = "WeatherImage") - protected String weatherImage; - @XmlElement(name = "MaxTemperatureF") - protected String maxTemperatureF; - @XmlElement(name = "MinTemperatureF") - protected String minTemperatureF; - @XmlElement(name = "MaxTemperatureC") - protected String maxTemperatureC; - @XmlElement(name = "MinTemperatureC") - protected String minTemperatureC; - - /** - * Gets the value of the day property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDay() { - return day; - } - - /** - * Sets the value of the day property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDay(String value) { - this.day = value; - } - - /** - * Gets the value of the weatherImage property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWeatherImage() { - return weatherImage; - } - - /** - * Sets the value of the weatherImage property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWeatherImage(String value) { - this.weatherImage = value; - } - - /** - * Gets the value of the maxTemperatureF property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMaxTemperatureF() { - return maxTemperatureF; - } - - /** - * Sets the value of the maxTemperatureF property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMaxTemperatureF(String value) { - this.maxTemperatureF = value; - } - - /** - * Gets the value of the minTemperatureF property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMinTemperatureF() { - return minTemperatureF; - } - - /** - * Sets the value of the minTemperatureF property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMinTemperatureF(String value) { - this.minTemperatureF = value; - } - - /** - * Gets the value of the maxTemperatureC property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMaxTemperatureC() { - return maxTemperatureC; - } - - /** - * Sets the value of the maxTemperatureC property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMaxTemperatureC(String value) { - this.maxTemperatureC = value; - } - - /** - * Gets the value of the minTemperatureC property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMinTemperatureC() { - return minTemperatureC; - } - - /** - * Sets the value of the minTemperatureC property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMinTemperatureC(String value) { - this.minTemperatureC = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java deleted file mode 100644 index 0902ce67fe..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecast.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.logging.Logger; - -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceFeature; - - -/** - * Get one week weather forecast for valid zip code or Place name in USA - * - * This class was generated by the JAX-WS RI. - * JAX-WS RI 2.1.3-b02- - * Generated source version: 2.1 - * - */ -@WebServiceClient(name = "WeatherForecast", targetNamespace = "http://www.webservicex.net", wsdlLocation = "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl") -public class WeatherForecast - extends Service -{ - - private final static URL WEATHERFORECAST_WSDL_LOCATION; - private final static Logger logger = Logger.getLogger(com.example.weather.WeatherForecast.class.getName()); - - static { - URL url = null; - try { - URL baseUrl; - baseUrl = com.example.weather.WeatherForecast.class.getResource("."); - url = new URL(baseUrl, "file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl"); - } catch (MalformedURLException e) { - logger.warning("Failed to create URL for the wsdl Location: 'file:/C:/Tuscany/java/sca/demos/us-location/src/main/resources/wsdl/WeatherForecast.wsdl', retrying as a local file"); - logger.warning(e.getMessage()); - } - WEATHERFORECAST_WSDL_LOCATION = url; - } - - public WeatherForecast(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public WeatherForecast() { - super(WEATHERFORECAST_WSDL_LOCATION, new QName("http://www.webservicex.net", "WeatherForecast")); - } - - /** - * - * @return - * returns WeatherForecastSoap - */ - @WebEndpoint(name = "WeatherForecastSoap") - public WeatherForecastSoap getWeatherForecastSoap() { - return super.getPort(new QName("http://www.webservicex.net", "WeatherForecastSoap"), WeatherForecastSoap.class); - } - - /** - * - * @param features - * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. - * @return - * returns WeatherForecastSoap - */ - @WebEndpoint(name = "WeatherForecastSoap") - public WeatherForecastSoap getWeatherForecastSoap(WebServiceFeature... features) { - return super.getPort(new QName("http://www.webservicex.net", "WeatherForecastSoap"), WeatherForecastSoap.class, features); - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java deleted file mode 100644 index aa000a44d2..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecastSoap.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -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- - * Generated source version: 2.1 - * - */ -@WebService(name = "WeatherForecastSoap", targetNamespace = "http://www.webservicex.net") -@XmlSeeAlso({ - ObjectFactory.class -}) -public interface WeatherForecastSoap { - - - /** - * Get one week weather forecast for a valid Zip Code(USA) - * - * @param zipCode - * @return - * returns com.example.weather.WeatherForecasts - */ - @WebMethod(operationName = "GetWeatherByZipCode", action = "http://www.webservicex.net/GetWeatherByZipCode") - @WebResult(name = "GetWeatherByZipCodeResult", targetNamespace = "http://www.webservicex.net") - @RequestWrapper(localName = "GetWeatherByZipCode", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByZipCode") - @ResponseWrapper(localName = "GetWeatherByZipCodeResponse", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByZipCodeResponse") - public WeatherForecasts getWeatherByZipCode( - @WebParam(name = "ZipCode", targetNamespace = "http://www.webservicex.net") - String zipCode); - - /** - * Get one week weather forecast for a place name(USA) - * - * @param placeName - * @return - * returns com.example.weather.WeatherForecasts - */ - @WebMethod(operationName = "GetWeatherByPlaceName", action = "http://www.webservicex.net/GetWeatherByPlaceName") - @WebResult(name = "GetWeatherByPlaceNameResult", targetNamespace = "http://www.webservicex.net") - @RequestWrapper(localName = "GetWeatherByPlaceName", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByPlaceName") - @ResponseWrapper(localName = "GetWeatherByPlaceNameResponse", targetNamespace = "http://www.webservicex.net", className = "com.example.weather.GetWeatherByPlaceNameResponse") - public WeatherForecasts getWeatherByPlaceName( - @WebParam(name = "PlaceName", targetNamespace = "http://www.webservicex.net") - String placeName); - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java deleted file mode 100644 index 8ded0946d9..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/WeatherForecasts.java +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package com.example.weather; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Java class for WeatherForecasts complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="WeatherForecasts">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="Latitude" type="{http://www.w3.org/2001/XMLSchema}float"/>
- *         <element name="Longitude" type="{http://www.w3.org/2001/XMLSchema}float"/>
- *         <element name="AllocationFactor" type="{http://www.w3.org/2001/XMLSchema}float"/>
- *         <element name="FipsCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="PlaceName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="StateCode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="Status" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- *         <element name="Details" type="{http://www.webservicex.net}ArrayOfWeatherData" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "WeatherForecasts", propOrder = { - "latitude", - "longitude", - "allocationFactor", - "fipsCode", - "placeName", - "stateCode", - "status", - "details" -}) -public class WeatherForecasts { - - @XmlElement(name = "Latitude") - protected float latitude; - @XmlElement(name = "Longitude") - protected float longitude; - @XmlElement(name = "AllocationFactor") - protected float allocationFactor; - @XmlElement(name = "FipsCode") - protected String fipsCode; - @XmlElement(name = "PlaceName") - protected String placeName; - @XmlElement(name = "StateCode") - protected String stateCode; - @XmlElement(name = "Status") - protected String status; - @XmlElement(name = "Details") - protected ArrayOfWeatherData details; - - /** - * Gets the value of the latitude property. - * - */ - public float getLatitude() { - return latitude; - } - - /** - * Sets the value of the latitude property. - * - */ - public void setLatitude(float value) { - this.latitude = value; - } - - /** - * Gets the value of the longitude property. - * - */ - public float getLongitude() { - return longitude; - } - - /** - * Sets the value of the longitude property. - * - */ - public void setLongitude(float value) { - this.longitude = value; - } - - /** - * Gets the value of the allocationFactor property. - * - */ - public float getAllocationFactor() { - return allocationFactor; - } - - /** - * Sets the value of the allocationFactor property. - * - */ - public void setAllocationFactor(float value) { - this.allocationFactor = value; - } - - /** - * Gets the value of the fipsCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFipsCode() { - return fipsCode; - } - - /** - * Sets the value of the fipsCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFipsCode(String value) { - this.fipsCode = value; - } - - /** - * Gets the value of the placeName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPlaceName() { - return placeName; - } - - /** - * Sets the value of the placeName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPlaceName(String value) { - this.placeName = value; - } - - /** - * Gets the value of the stateCode property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStateCode() { - return stateCode; - } - - /** - * Sets the value of the stateCode property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStateCode(String value) { - this.stateCode = value; - } - - /** - * Gets the value of the status property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setStatus(String value) { - this.status = value; - } - - /** - * Gets the value of the details property. - * - * @return - * possible object is - * {@link ArrayOfWeatherData } - * - */ - public ArrayOfWeatherData getDetails() { - return details; - } - - /** - * Sets the value of the details property. - * - * @param value - * allowed object is - * {@link ArrayOfWeatherData } - * - */ - public void setDetails(ArrayOfWeatherData value) { - this.details = value; - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java b/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java deleted file mode 100644 index 6543ed7abf..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/com/example/weather/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webservicex.net", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.example.weather; diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/location/LocationClient.java b/java/sca/samples/zipcode-jaxws/src/main/java/location/LocationClient.java deleted file mode 100644 index 35c114093a..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/location/LocationClient.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package location; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import com.example.uszip.GetInfoByZIPResponse; -import com.example.uszip.USZipSoap; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class LocationClient { - - public static void main(String[] args) throws Exception { - - SCADomain domain = SCADomain.newInstance("USLocation.composite"); - USZipSoap zipService = domain.getService(USZipSoap.class, "USLocationService"); - - GetInfoByZIPResponse.GetInfoByZIPResult result = zipService.getInfoByZIP("94555"); - - GetInfoByZIPResponse response = new GetInfoByZIPResponse(); - response.setGetInfoByZIPResult(result); - - JAXBContext context = JAXBContext.newInstance(GetInfoByZIPResponse.class); - StringWriter writer = new StringWriter(); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(response, writer); - - String xml = writer.toString(); - System.out.println(xml); - } -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java b/java/sca/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java deleted file mode 100644 index 8865d5fe82..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/location/USLocationImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package location; - -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.example.uszip.USZipSoap; -import com.example.uszip.GetInfoByAreaCodeResponse.GetInfoByAreaCodeResult; -import com.example.uszip.GetInfoByCityResponse.GetInfoByCityResult; -import com.example.uszip.GetInfoByStateResponse.GetInfoByStateResult; -import com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult; - -/** - * @version $Rev$ $Date$ - */ -@Service(USZipSoap.class) -@AllowsPassByReference -public class USLocationImpl implements USZipSoap { - @Reference - protected USZipSoap usZipService; - - public GetInfoByAreaCodeResult getInfoByAreaCode(String usAreaCode) { - return usZipService.getInfoByAreaCode(usAreaCode); - } - - public GetInfoByCityResult getInfoByCity(String usCity) { - return usZipService.getInfoByCity(usCity); - } - - public GetInfoByStateResult getInfoByState(String usState) { - return usZipService.getInfoByState(usState); - } - - public GetInfoByZIPResult getInfoByZIP(String usZip) { - return usZipService.getInfoByZIP(usZip); - } -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java b/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java deleted file mode 100644 index c03cf2955f..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastClient.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package weather; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -import com.example.weather.GetWeatherByZipCodeResponse; -import com.example.weather.WeatherForecastSoap; -import com.example.weather.WeatherForecasts; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class WeatherForecastClient { - - public static void main(String[] args) throws Exception { - - SCADomain domain = SCADomain.newInstance("WeatherForecast.composite"); - WeatherForecastSoap weatherService = domain.getService(WeatherForecastSoap.class, "WeatherForecastService"); - - WeatherForecasts result = weatherService.getWeatherByZipCode("94555"); - - // Dump the result as XML - - // Wrap the result so that it can be marshaled - GetWeatherByZipCodeResponse response = new GetWeatherByZipCodeResponse(); - response.setGetWeatherByZipCodeResult(result); - - // Marshal the JAXB object into XML - JAXBContext context = JAXBContext.newInstance(GetWeatherByZipCodeResponse.class); - StringWriter writer = new StringWriter(); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(response, writer); - - String xml = writer.toString(); - System.out.println(xml); - } -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java b/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java deleted file mode 100644 index 5ad5f11344..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/weather/WeatherForecastImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package weather; - -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.example.weather.WeatherForecastSoap; -import com.example.weather.WeatherForecasts; - -/** - * @version $Rev$ $Date$ - */ -@Service(WeatherForecastSoap.class) -public class WeatherForecastImpl implements WeatherForecastSoap{ - @Reference - protected WeatherForecastSoap weatherForecast; - - public WeatherForecasts getWeatherByPlaceName(String placeName) { - return weatherForecast.getWeatherByPlaceName(placeName); - } - - public WeatherForecasts getWeatherByZipCode(String zipCode) { - return weatherForecast.getWeatherByZipCode(zipCode); - } -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java b/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java deleted file mode 100644 index f181d9bd0e..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeClient.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package zipcode; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This client program to invoke the Mortgage LoanApproval service - */ -public class ZipCodeClient { - - public static void main(String[] args) throws Exception { - - System.out.println("Please wait..."); - - SCADomain domain = SCADomain.newInstance("ZipCode.composite"); - ZipCodeService zipService = domain.getService(ZipCodeService.class, "ZipCodeService"); - - String result = zipService.lookup("94555"); - System.out.println(result); - } -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java b/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java deleted file mode 100644 index 53c112b8a3..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package zipcode; - -import org.oasisopen.sca.annotation.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@Remotable -public interface ZipCodeService { - String lookup(String zipCode); -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java b/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java deleted file mode 100644 index 7c68a77cf2..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/java/zipcode/ZipCodeServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package zipcode; - -import java.io.StringWriter; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; - -import org.oasisopen.sca.ServiceRuntimeException; -import org.oasisopen.sca.annotation.AllowsPassByReference; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Service; - -import com.example.uszip.GetInfoByZIPResponse; -import com.example.uszip.USZipSoap; -import com.example.uszip.GetInfoByZIPResponse.GetInfoByZIPResult; -import com.example.weather.GetWeatherByZipCodeResponse; -import com.example.weather.WeatherForecastSoap; -import com.example.weather.WeatherForecasts; - -/** - * @version $Rev$ $Date$ - */ -@Service(ZipCodeService.class) -@AllowsPassByReference -public class ZipCodeServiceImpl implements ZipCodeService { - @Reference - protected USZipSoap usZipService; - - @Reference - protected WeatherForecastSoap weatherForecast; - - public String lookup(String zipCode) { - GetInfoByZIPResult result1 = usZipService.getInfoByZIP(zipCode); - - GetInfoByZIPResponse response1 = new GetInfoByZIPResponse(); - response1.setGetInfoByZIPResult(result1); - - String xml1 = toXML(response1); - - WeatherForecasts result2 = weatherForecast.getWeatherByZipCode(zipCode); - // Wrap the result so that it can be marshaled - GetWeatherByZipCodeResponse response2 = new GetWeatherByZipCodeResponse(); - response2.setGetWeatherByZipCodeResult(result2); - - String xml2 = toXML(response2); - // Marshal the JAXB object into XML - return xml1 + "\n" + xml2; - } - - private String toXML(Object jaxb) { - try { - JAXBContext context = JAXBContext.newInstance(jaxb.getClass()); - StringWriter writer = new StringWriter(); - Marshaller marshaller = context.createMarshaller(); - marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); - marshaller.marshal(jaxb, writer); - return writer.toString(); - } catch (Exception e) { - throw new ServiceRuntimeException(e); - } - } - -} diff --git a/java/sca/samples/zipcode-jaxws/src/main/resources/USLocation.composite b/java/sca/samples/zipcode-jaxws/src/main/resources/USLocation.composite deleted file mode 100644 index a171fe62c9..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/resources/USLocation.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite b/java/sca/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite deleted file mode 100644 index 0e1b118e44..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/resources/WeatherForecast.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - diff --git a/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite b/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite deleted file mode 100644 index 28d674c29b..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java b/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java deleted file mode 100644 index 019fce26d6..0000000000 --- a/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package zipcode; - -import location.LocationClient; -import weather.WeatherForecastClient; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -/** - * Tests that the callback server is available - */ -public class ZipCodeClientTestCase { - - @Before - public void startServer() throws Exception { - } - - @Test - public void testClient() throws Exception { - /* - System.out.println("Running LocationClient..."); - LocationClient.main(null); - System.out.println("Running WeatherForecastClient..."); - WeatherForecastClient.main(null); - */ - System.out.println("Running ZipCodeClient..."); - ZipCodeClient.main(null); - } - - @After - public void stopServer() throws Exception { - } -} -- cgit v1.2.3