From 5e520b1b65c79cd828057cb628b9367acb266880 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 11 Nov 2009 23:05:59 +0000 Subject: Moving 1.x branches git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835117 13f79535-47bb-0310-9956-ffa450edef68 --- branches/sca-android/samples/README | 306 ---------- .../samples/binding-echo-extension/README | 74 --- .../samples/binding-echo-extension/build.xml | 51 -- .../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 -- branches/sca-android/samples/binding-echo/README | 104 ---- .../samples/binding-echo/binding-echo.png | Bin 7846 -> 0 bytes .../samples/binding-echo/binding-echo.svg | 174 ------ .../sca-android/samples/binding-echo/build.xml | 75 --- branches/sca-android/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-android/samples/calculator-lean/README | 87 --- .../samples/calculator-lean/calculator.png | Bin 20552 -> 0 bytes .../samples/calculator-lean/calculator.svg | 329 ----------- .../sca-android/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 -- branches/sca-android/samples/calculator/README | 97 --- branches/sca-android/samples/calculator/build.xml | 72 --- .../sca-android/samples/calculator/calculator.png | Bin 20552 -> 0 bytes .../sca-android/samples/calculator/calculator.svg | 329 ----------- branches/sca-android/samples/calculator/pom.xml | 71 --- .../src/main/java/calculator/AddService.java | 28 - .../src/main/java/calculator/AddServiceImpl.java | 35 -- .../src/main/java/calculator/CalculatorClient.java | 48 -- .../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 | 56 -- .../sca-android/samples/databinding-echo/README | 143 ----- .../sca-android/samples/databinding-echo/build.xml | 75 --- .../samples/databinding-echo/databinding-echo.png | Bin 23907 -> 0 bytes .../samples/databinding-echo/databinding-echo.svg | 408 ------------- .../sca-android/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 -- .../samples/implementation-composite/README | 116 ---- .../samples/implementation-composite/build.xml | 72 --- .../implementation-composite.png | Bin 47415 -> 0 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-android/samples/implementation-crud/README | 113 ---- .../samples/implementation-crud/build.xml | 75 --- .../implementation-crud/implementation-crud.png | Bin 4227 -> 0 bytes .../implementation-crud/implementation-crud.svg | 135 ----- .../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-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 -- branches/sca-android/samples/pom.xml | 62 -- branches/sca-android/samples/simple-bigbank/README | 101 ---- .../sca-android/samples/simple-bigbank/build.xml | 72 --- .../sca-android/samples/simple-bigbank/pom.xml | 65 -- .../samples/simple-bigbank/simple-bigbank.png | Bin 10202 -> 0 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 -- .../sca-android/samples/simple-callback/README | 97 --- .../sca-android/samples/simple-callback/build.xml | 72 --- .../sca-android/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 -- branches/sca-android/samples/supplychain/README | 101 ---- branches/sca-android/samples/supplychain/build.xml | 72 --- branches/sca-android/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 -- .../samples/supplychain/supplychain.png | Bin 3898 -> 0 bytes .../samples/supplychain/supplychain.svg | 228 ------- 213 files changed, 12795 deletions(-) delete mode 100644 branches/sca-android/samples/README delete mode 100644 branches/sca-android/samples/binding-echo-extension/README delete mode 100644 branches/sca-android/samples/binding-echo-extension/build.xml delete mode 100644 branches/sca-android/samples/binding-echo-extension/pom.xml delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite delete mode 100644 branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml delete mode 100644 branches/sca-android/samples/binding-echo/README delete mode 100644 branches/sca-android/samples/binding-echo/binding-echo.png delete mode 100644 branches/sca-android/samples/binding-echo/binding-echo.svg delete mode 100644 branches/sca-android/samples/binding-echo/build.xml delete mode 100644 branches/sca-android/samples/binding-echo/pom.xml delete mode 100644 branches/sca-android/samples/binding-echo/src/main/java/echo/Echo.java delete mode 100644 branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java delete mode 100644 branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java delete mode 100644 branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite delete mode 100644 branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java delete mode 100644 branches/sca-android/samples/calculator-lean/README delete mode 100644 branches/sca-android/samples/calculator-lean/calculator.png delete mode 100644 branches/sca-android/samples/calculator-lean/calculator.svg delete mode 100644 branches/sca-android/samples/calculator-lean/pom.xml delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddService.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideService.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite delete mode 100644 branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite delete mode 100644 branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 branches/sca-android/samples/calculator/README delete mode 100644 branches/sca-android/samples/calculator/build.xml delete mode 100644 branches/sca-android/samples/calculator/calculator.png delete mode 100644 branches/sca-android/samples/calculator/calculator.svg delete mode 100644 branches/sca-android/samples/calculator/pom.xml delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/AddService.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/DivideService.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java delete mode 100644 branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java delete mode 100644 branches/sca-android/samples/calculator/src/main/resources/Calculator.composite delete mode 100644 branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java delete mode 100644 branches/sca-android/samples/databinding-echo/README delete mode 100644 branches/sca-android/samples/databinding-echo/build.xml delete mode 100644 branches/sca-android/samples/databinding-echo/databinding-echo.png delete mode 100644 branches/sca-android/samples/databinding-echo/databinding-echo.svg delete mode 100644 branches/sca-android/samples/databinding-echo/pom.xml delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Echo.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface1.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface2.java delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite delete mode 100644 branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl delete mode 100644 branches/sca-android/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java delete mode 100644 branches/sca-android/samples/implementation-composite/README delete mode 100644 branches/sca-android/samples/implementation-composite/build.xml delete mode 100644 branches/sca-android/samples/implementation-composite/implementation-composite.png delete mode 100644 branches/sca-android/samples/implementation-composite/implementation-composite.svg delete mode 100644 branches/sca-android/samples/implementation-composite/pom.xml delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/CompositeClient.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/Source.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceCallback.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceImpl.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/Target.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/java/composite/TargetImpl.java delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml delete mode 100644 branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite delete mode 100644 branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/README delete mode 100644 branches/sca-android/samples/implementation-crud-extension/build.xml delete mode 100644 branches/sca-android/samples/implementation-crud-extension/pom.xml delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java delete mode 100644 branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite delete mode 100644 branches/sca-android/samples/implementation-crud/README delete mode 100644 branches/sca-android/samples/implementation-crud/build.xml delete mode 100644 branches/sca-android/samples/implementation-crud/implementation-crud.png delete mode 100644 branches/sca-android/samples/implementation-crud/implementation-crud.svg delete mode 100644 branches/sca-android/samples/implementation-crud/pom.xml delete mode 100644 branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java delete mode 100644 branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite delete mode 100644 branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/README delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/build.xml delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/pom.xml delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType delete mode 100644 branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite delete mode 100644 branches/sca-android/samples/pom.xml delete mode 100644 branches/sca-android/samples/simple-bigbank/README delete mode 100644 branches/sca-android/samples/simple-bigbank/build.xml delete mode 100644 branches/sca-android/samples/simple-bigbank/pom.xml delete mode 100644 branches/sca-android/samples/simple-bigbank/simple-bigbank.png delete mode 100644 branches/sca-android/samples/simple-bigbank/simple-bigbank.svg delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite delete mode 100644 branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite delete mode 100644 branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java delete mode 100644 branches/sca-android/samples/simple-callback/README delete mode 100644 branches/sca-android/samples/simple-callback/build.xml delete mode 100644 branches/sca-android/samples/simple-callback/pom.xml delete mode 100644 branches/sca-android/samples/simple-callback/simple-callback.png delete mode 100644 branches/sca-android/samples/simple-callback/simple-callback.svg delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClient.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyService.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java delete mode 100644 branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite delete mode 100644 branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java delete mode 100644 branches/sca-android/samples/supplychain/README delete mode 100644 branches/sca-android/samples/supplychain/build.xml delete mode 100644 branches/sca-android/samples/supplychain/pom.xml delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/Customer.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/Retailer.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/Shipper.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/Warehouse.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java delete mode 100644 branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite delete mode 100644 branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java delete mode 100644 branches/sca-android/samples/supplychain/supplychain.png delete mode 100644 branches/sca-android/samples/supplychain/supplychain.svg (limited to 'branches/sca-android/samples') diff --git a/branches/sca-android/samples/README b/branches/sca-android/samples/README deleted file mode 100644 index 2646fbb73a..0000000000 --- a/branches/sca-android/samples/README +++ /dev/null @@ -1,306 +0,0 @@ -The Apache Tuscany SCA Samples -============================== -The Apache Tuscany SCA samples are built as part of the main Maven build and -run, using the provided JUnit test cases, as tests in the Maven build. - -In the binary distribution of Apache Tuscany most samples can also -be run using the provided Ant build.xml files. These show the samples running -from a simple main() method without the need for a JUnit test case. - -In these notes text that appears in angled brackets like this means -that you need to make a choice and provide your own text at that point. - -These simple samples have been created with the intention of illustrating the -usage of the SCA API and annotations and certainly not to levels of SCA component -abstraction. In real life situations you should use SCA to assemble real and -usually bigger components, and when you do that you'll get all the benefits of -SCA, bindings, policies, integration in an SOA environment etc.. - -Sample Overview ---------------- -The samples generally show off different features of the SCA runtime -and the extensions that come packaged with it. - -binding-notification-broker - A broker for notificatione -binding-notification-consumer - A consumer of notifications -binding-notification-producer - A producer of notifications - -calculator - Calculator built with java components and - local wires. -calculator-distributed - A calculator built using SCA nodes running - on multiple JVMs -calculator-implementation-policies - Shows logging policites associated with - SCA implementations -calculator-rmi-reference - The calculator configured to talk RMI to - the calculator-rmi-service sample -calculator-rmi-service - The calculator configured to accept RMI - requests from calculator-rmi-reference -calculator-script - Calculator built using various script languages -calculator-webapp - Calculator running inside a web app -calculator-ws-webapp - Calculator running inside a web app also - showing webservices binding - -callbck-ws-client - The client for showing callbacks across web services -callback-ws-service - The server for showing callbacks across web serviced - -chat-webapp - A simple chat style web app demonstrating - use of AJAX binding - -databinding-echo - An SCA application that shows how databindings - transform data - -feed-aggregator - Demonstrates using the ATOM binding -feed-aggregator-webapp - feed-aggregator running in webapp - -helloworld-bpel - Demonstrates an SCA component invoking a BPEL - process in a composition - -helloworld-dojo-webapp - An SCA application that exposes a service using - JSONRPC and a client using the Dojo toolkit -helloworld-jsonrpc-webapp - helloworld using jsonrpc binding -helloworld-ws-reference - The client side of a hello world sample that uses a - web service binding (requires helloworld-ws-service) -helloworld-ws-service - The server side of a hello world sample that uses a - web service binding -helloworld-ws-reference-jms - The client side of a hello world sample that uses a - web service binding with SOAP/JMS (requires - helloworld-ws-service) -helloworld-ws-service-jms - The server side of a hello world sample that - uses a web service binding with SOAP/JMS -helloworld-ws-reference-secure - The client side of a hello world sample that - shows how policy intent can be used. -helloworld-ws-service-secure - The client side of a hello world sample that - shows how policy intent can be used. -helloworld-ws-sdo - helloworld using ws binding and SDO -helloworld-ws-sdo-webapp - helloworld using ws binding and SDO within a webapp - -implementation-composite - Shows how SCA composites are used - -osgi-supplychain - SCA asynchronous API with OSGi and Java - implementation types - -simple-bigbank - A banking application built with java components - and local wire -simple-bigbank-spring - A banking application showing how SCA works with Spring - -simple-callback - demonstrates the callback interface -simple-callback-ws - demonstrates use of callback interface across WS binding - -store - Step by step guide for creating an online store - -supplychain - shows how asynchronous callbacks can be used - -web-resource - Demonstrates using an SCA Web resource component - -quote-xquery - Demonstrate SCA components using XQuery - -Samples for building extensions -------------------------------- -There are samples that demonstrate how to build extensions for the -Tuscany SCA runtime. These samples are slightly different from the samples -above in that the provided code is concerned with building the extension -and not with building an application that uses it. The application -that shows how the new extension can be used is provided in an associated -sample. - -implementation-crud-extension - Shows how to build new implementation type - extensions -implementation-crud - A sample application that exercises the new - implementation extensions -binding-echo-extension - Shows how to build new binding extensions -binding-echo - A sample application that exercises the new - binding extension -implementation-notifiaction- Illustrates the use of -implementation-pojo-extension - shows how new implementation types are constructed - -Sample Layout -------------- -All sample directories are organized in the same way based on the default -project template provided by Maven. For example, take a look at the calculator -sample; - -calculator/ - src/ - Holds all of the source files for the sample - main/ - Groups together the files that implement the sample - java/ - Java source files - resources/ - Non java resource files such as composte files - test/ - Groups together files that provide sample tests - java - Java test sources files. Usually JUnit test cases - target/ - Holds the files generated when the sample is built - classes/ - For example, Java class files - test-classes/ - classes from src/test and other test files - -Getting Ready To Build ----------------------- -You will need to install the following software before you start. - -J2SE Development Kit (JDK) 5.0 -Apache Ant 1.7.0 - if you are going to use Ant -Apache Maven 2.0.6 - if you are going to use Maven - -Java and Ant and/or Maven binary directories must be present in your PATH so -that their executable programs are available in your environment. You may -find it useful to use a script to set up your environment, for example; - -For UNIX: - JAVA_HOME=/ - ANT_HOME=//apache-ant-1.7.0 - MAVEN_HOME=//maven-2.0.6 - export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$MAVEN_HOME/bin:$PATH - -For Windows: - set JAVA_HOME=C:\ - set ANT_HOME=C:\\apache-ant-1.7.0 - set MAVEN_HOME=C:\\maven-2.0.6 - set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin;%MAVEN_HOME%\bin;%PATH% - - -Building And Running The SCA Samples Using Ant ----------------------------------------------- -The build.xml files provided with the Apache Tuscany SCA samples are designed -to work with the binary distribution. They rely on the tuscany-sca-manifest.jar -to describe the class path and this jar is only provided as part of the -binary distribution. - -The binary distribution of SCA also includes precompiled versions of each sample. -If you look in the target directory of each sample you will see this jar file. To -run a sample based on all of the precompiled artifacts all you have to do is: - -cd -ant run - -Check each /README file as some samples require that two progams are -run to get the desired result, for example, the two samples that show how -to build extensions are run from their associated application samples. - -If you want to rebuild a sample, for example, if you have changed it, do the -following: - -cd -ant compile - -Once the sample is built you have the option of running the sample in whatever -way best suits you. Two alternatives are provided in the ant build files. - -The compile target builds the class files and then builds the jar so you can use -the same command as before: - -ant run - -This will use the generated jar to run the samples. The command line version of -this is: - -on Windows - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\ - -for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\sample-calculator.jar calculator.CalculatorClient - -on *nix - -java -cp ../../lib/tuscany-sca-manifest.jar:target/ - -for example : java -cp ../../lib/tuscany-sca-manifest.jar:target/sample-calculator.jar calculator.CalculatorClient - - -You can use the compiled classes directly using - -ant run-classes - -The command line version of this is: - -on Windows - -java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes - -for example : java -cp ..\..\lib\tuscany-sca-manifest.jar;target\classes calculator.CalculatorClient - -on *nix - -java -cp ../../lib/tuscany-sca-manifest.jar:target/classes - -for example : java -cp ../../lib/tuscany-sca-manifest.jar:target/classes calculator.CalculatorClient - -The class specified on the command of course depends on which sample you want to -run. In the examples we have used we are running the CalculatorClient from the calculator sample. - - -Building And Running The SCA Samples Using Maven ------------------------------------------------- - -The Maven build process will work from both source and binary distributions. -To build and test all of the Apache Tuscany SCA sources, including the samples, -do the following. - -cd sca -mvn - -This will take a little while to complete. Experience with Maven tells us that -sometimes there are problems downloading the dependencies that Apache Tuscany -SCA requires. If Maven reports that it cannot download required dependencies -try running the Maven build again. - -Once you have all of the source built you can build and run each sample -independently if required. - -cd -mvn - -When using Maven the samples are run within JUnit test cases and so you will -sometimes not see any test output. You will always see an indication of test -success or failure. - -Using The Samples In An IDE ---------------------------------------------- -The easiest way to use the samples in an IDE is to use Maven to generate all -of the IDE project files for you automatically. This works best if you -generate IDE projects for all of the Apache Tuscany modules. You can then -include the ones you are interested in working with in you IDE. - -To build IDE project files for all of the modules in Apache Tuscany SCA; - -cd sca - -If you are an Eclipse user do the following - -mvn -Peclipse eclipse:eclipse - -If you are an IDEA user do the following - -mvn idea:idea - -These commands generate project files for each module in Apache Tuscany SCA. -The modules you are interested in can now be included in your IDE, for example, -in Eclipse, if you create a new Java project and use the option to "create a -new project from existing source" you can specify an SCA module directory, -which includes the generated project files, and Eclipse will treat it like any -other Java project. - -Using The Samples In An IDE Without Maven ------------------------------------------ -We don't provide any IDE project files with our distributions so you will have to -import the sample files into your IDE manually. Here's an example of how it can be -done using Eclipse. - -In a new or existing workspace - Create a new java project to represent the sample you want to work on, e.g. - calculator - Import all of the sample code and resources into this project, e.g. - File, Import and then select tuscany-sca-1.0-incubating\samples\calculator from the filesystem - Configure the source path to include - src/main/java - src/main/resources - Configure the output folder to be - calculator/target - Configure the build path to include all of the jars provided in - lib - If you select calculator.CalculatorClient.java and run as "Java Application" you should see - 3 + 2=5.0 - 3 - 2=1.0 - 3 * 2=6.0 - 3 / 2=1.5 - -The details of how to do this for other development environments will -vary but the process will be similar. - - diff --git a/branches/sca-android/samples/binding-echo-extension/README b/branches/sca-android/samples/binding-echo-extension/README deleted file mode 100644 index 94716b151f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/build.xml b/branches/sca-android/samples/binding-echo-extension/build.xml deleted file mode 100644 index 5df5981bea..0000000000 --- a/branches/sca-android/samples/binding-echo-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/binding-echo-extension/pom.xml b/branches/sca-android/samples/binding-echo-extension/pom.xml deleted file mode 100644 index 2d516f2101..0000000000 --- a/branches/sca-android/samples/binding-echo-extension/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.4-SNAPSHOT - test - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - test - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBinding.java deleted file mode 100644 index 3fe1598e0d..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/EchoBindingFactory.java deleted file mode 100644 index 0f6fee82be..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingFactoryImpl.java deleted file mode 100644 index af759dbf93..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingImpl.java deleted file mode 100644 index 19c9271bb8..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/impl/EchoBindingProcessor.java deleted file mode 100644 index 45fdb73f67..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingInvoker.java deleted file mode 100644 index 91697fcd9a..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingPoliciedInvoker.java deleted file mode 100644 index 4877bade7f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoBindingProviderFactory.java deleted file mode 100644 index ba74d8f99a..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoReferenceBindingProvider.java deleted file mode 100644 index 0efc319af9..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/EchoServiceBindingProvider.java deleted file mode 100644 index 1cd1e5af4e..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicy.java deleted file mode 100644 index 33dc761aa4..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingEncryptionPolicyProcessor.java deleted file mode 100644 index c847d088a6..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicy.java deleted file mode 100644 index 7d38e3b7a8..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EchoBindingPolicyProcessor.java deleted file mode 100644 index 72b8002238..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionPolicyHandler.java deleted file mode 100644 index deda8d9744..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/EncryptionStrategy.java deleted file mode 100644 index ffadfc7fff..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/PolicyHandler.java deleted file mode 100644 index 6fa5f26977..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/ReverseEncryptionStrategy.java deleted file mode 100644 index cf55b36fc2..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicy.java deleted file mode 100644 index ac610cfb51..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/provider/policy/WSPolicyProcessor.java deleted file mode 100644 index fcb250b444..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServer.java deleted file mode 100644 index 8ea2395d04..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java b/branches/sca-android/samples/binding-echo-extension/src/main/java/echo/server/EchoServiceListener.java deleted file mode 100644 index 32336dd94f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory b/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/echo.EchoBindingFactory deleted file mode 100644 index 55be293862..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-android/samples/binding-echo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory deleted file mode 100644 index efa475ef92..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd b/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd deleted file mode 100644 index 9b64df4871..0000000000 --- a/branches/sca-android/samples/binding-echo-extension/src/main/resources/sample-binding-echo.xsd +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java b/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/Echo.java deleted file mode 100644 index 1d5e973f33..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java b/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoComponentImpl.java deleted file mode 100644 index ba68dfe908..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.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/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java b/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoReferenceTestCase.java deleted file mode 100644 index 7383077f18..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java b/branches/sca-android/samples/binding-echo-extension/src/test/java/echo/EchoServiceTestCase.java deleted file mode 100644 index ab05516622..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite b/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite deleted file mode 100644 index 176d67cc4b..0000000000 --- a/branches/sca-android/samples/binding-echo-extension/src/test/resources/EchoBinding.composite +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml b/branches/sca-android/samples/binding-echo-extension/src/test/resources/definitions.xml deleted file mode 100644 index 1cb1d1c9ba..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo/README b/branches/sca-android/samples/binding-echo/README deleted file mode 100644 index 2772460cc6..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo/binding-echo.png b/branches/sca-android/samples/binding-echo/binding-echo.png deleted file mode 100644 index a38d985363..0000000000 Binary files a/branches/sca-android/samples/binding-echo/binding-echo.png and /dev/null differ diff --git a/branches/sca-android/samples/binding-echo/binding-echo.svg b/branches/sca-android/samples/binding-echo/binding-echo.svg deleted file mode 100644 index 5b5051bef5..0000000000 --- a/branches/sca-android/samples/binding-echo/binding-echo.svg +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - EchoBinding - - - EchoComponent - - - - EchoSerivce EchoReference - - - diff --git a/branches/sca-android/samples/binding-echo/build.xml b/branches/sca-android/samples/binding-echo/build.xml deleted file mode 100644 index 7689ef3a54..0000000000 --- a/branches/sca-android/samples/binding-echo/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/binding-echo/pom.xml b/branches/sca-android/samples/binding-echo/pom.xml deleted file mode 100644 index 9c14b5d4c3..0000000000 --- a/branches/sca-android/samples/binding-echo/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - sample-binding-echo-extension - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/binding-echo/src/main/java/echo/Echo.java b/branches/sca-android/samples/binding-echo/src/main/java/echo/Echo.java deleted file mode 100644 index 1d5e973f33..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java b/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoBindingClient.java deleted file mode 100644 index 21bdff4011..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java b/branches/sca-android/samples/binding-echo/src/main/java/echo/EchoComponentImpl.java deleted file mode 100644 index ba68dfe908..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.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/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite b/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite deleted file mode 100644 index 94612fb325..0000000000 --- a/branches/sca-android/samples/binding-echo/src/main/resources/EchoBinding.composite +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java b/branches/sca-android/samples/binding-echo/src/test/java/echo/EchoBindingTestCase.java deleted file mode 100644 index 1a597fc80f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/README b/branches/sca-android/samples/calculator-lean/README deleted file mode 100644 index a8aff232c6..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/calculator.png b/branches/sca-android/samples/calculator-lean/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/branches/sca-android/samples/calculator-lean/calculator.png and /dev/null differ diff --git a/branches/sca-android/samples/calculator-lean/calculator.svg b/branches/sca-android/samples/calculator-lean/calculator.svg deleted file mode 100644 index 0615925c50..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/pom.xml b/branches/sca-android/samples/calculator-lean/pom.xml deleted file mode 100644 index 10f4ae110f..0000000000 --- a/branches/sca-android/samples/calculator-lean/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 1.4-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddService.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 2bb8f96dcf..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 3d861f2018..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideService.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java b/branches/sca-android/samples/calculator-lean/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite b/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite deleted file mode 100644 index 913081b9be..0000000000 --- a/branches/sca-android/samples/calculator-lean/src/main/resources/Calculator.composite +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite b/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite deleted file mode 100644 index 906e2a3918..0000000000 --- a/branches/sca-android/samples/calculator-lean/src/main/resources/CalculatorTest.composite +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - diff --git a/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java b/branches/sca-android/samples/calculator-lean/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index a007a28f21..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.EagerInit; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.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/branches/sca-android/samples/calculator/README b/branches/sca-android/samples/calculator/README deleted file mode 100644 index ceb532faed..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/build.xml b/branches/sca-android/samples/calculator/build.xml deleted file mode 100644 index c4b755ef94..0000000000 --- a/branches/sca-android/samples/calculator/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/calculator/calculator.png b/branches/sca-android/samples/calculator/calculator.png deleted file mode 100644 index 995a57b1fd..0000000000 Binary files a/branches/sca-android/samples/calculator/calculator.png and /dev/null differ diff --git a/branches/sca-android/samples/calculator/calculator.svg b/branches/sca-android/samples/calculator/calculator.svg deleted file mode 100644 index 0615925c50..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/pom.xml b/branches/sca-android/samples/calculator/pom.xml deleted file mode 100644 index 4a2216c2e9..0000000000 --- a/branches/sca-android/samples/calculator/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-SNAPSHOT - ../../pom.xml - - sample-calculator - Apache Tuscany SCA Calculator Sample - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - org.apache.tuscany.sca - tuscany-node-api - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 1.4-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/branches/sca-android/samples/calculator/src/main/java/calculator/AddService.java b/branches/sca-android/samples/calculator/src/main/java/calculator/AddService.java deleted file mode 100644 index 188451ebac..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java b/branches/sca-android/samples/calculator/src/main/java/calculator/AddServiceImpl.java deleted file mode 100644 index 7ca8fb04b5..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java b/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.java deleted file mode 100644 index 3b2966e96d..0000000000 --- a/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorClient.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 calculator; - -import org.apache.tuscany.sca.node.SCAClient; -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 CalculatorClient { - public static void main(String[] args) throws Exception { - - SCANodeFactory factory = SCANodeFactory.newInstance(); - SCANode node = factory.createSCANodeFromClassLoader("Calculator.composite", CalculatorClient.class.getClassLoader()); - node.start(); - - CalculatorService calculatorService = ((SCAClient)node).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)); - - node.stop(); - } - -} diff --git a/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java b/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorService.java deleted file mode 100644 index 031fa8b912..0000000000 --- a/branches/sca-android/samples/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/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java b/branches/sca-android/samples/calculator/src/main/java/calculator/CalculatorServiceImpl.java deleted file mode 100644 index 3d861f2018..0000000000 --- a/branches/sca-android/samples/calculator/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.osoa.sca.annotations.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/branches/sca-android/samples/calculator/src/main/java/calculator/DivideService.java b/branches/sca-android/samples/calculator/src/main/java/calculator/DivideService.java deleted file mode 100644 index 30d248208b..0000000000 --- a/branches/sca-android/samples/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 divide service interface - */ -public interface DivideService { - - double divide(double n1, double n2); - -} diff --git a/branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java b/branches/sca-android/samples/calculator/src/main/java/calculator/DivideServiceImpl.java deleted file mode 100644 index 1323edf55a..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java b/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyService.java deleted file mode 100644 index 5290605938..0000000000 --- a/branches/sca-android/samples/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/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java b/branches/sca-android/samples/calculator/src/main/java/calculator/MultiplyServiceImpl.java deleted file mode 100644 index 91b803bc9e..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java b/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractService.java deleted file mode 100644 index bf0d1882b6..0000000000 --- a/branches/sca-android/samples/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 multiply service - */ -public interface SubtractService { - - double subtract(double n1, double n2); - -} diff --git a/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java b/branches/sca-android/samples/calculator/src/main/java/calculator/SubtractServiceImpl.java deleted file mode 100644 index 58cc4a3547..0000000000 --- a/branches/sca-android/samples/calculator/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/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite b/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite deleted file mode 100644 index 90872041b0..0000000000 --- a/branches/sca-android/samples/calculator/src/main/resources/Calculator.composite +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java b/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.java deleted file mode 100644 index 1b7476534a..0000000000 --- a/branches/sca-android/samples/calculator/src/test/java/calculator/CalculatorTestCase.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 calculator; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.node.SCAClient; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; - -/** - * This shows how to test the Calculator service component. - */ -public class CalculatorTestCase extends TestCase { - - private CalculatorService calculatorService; - private SCANode node; - - @Override - protected void setUp() throws Exception { - SCANodeFactory factory = SCANodeFactory.newInstance(); - node = factory.createSCANodeFromClassLoader("Calculator.composite", getClass().getClassLoader()); - node.start(); - - calculatorService = ((SCAClient)node).getService(CalculatorService.class, "CalculatorServiceComponent"); - } - - @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/branches/sca-android/samples/databinding-echo/README b/branches/sca-android/samples/databinding-echo/README deleted file mode 100644 index 67c1aa32d5..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/databinding-echo/build.xml b/branches/sca-android/samples/databinding-echo/build.xml deleted file mode 100644 index 7f2483f6fb..0000000000 --- a/branches/sca-android/samples/databinding-echo/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/databinding-echo/databinding-echo.png b/branches/sca-android/samples/databinding-echo/databinding-echo.png deleted file mode 100644 index afbbfff285..0000000000 Binary files a/branches/sca-android/samples/databinding-echo/databinding-echo.png and /dev/null differ diff --git a/branches/sca-android/samples/databinding-echo/databinding-echo.svg b/branches/sca-android/samples/databinding-echo/databinding-echo.svg deleted file mode 100644 index 87964abf86..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/databinding-echo/pom.xml b/branches/sca-android/samples/databinding-echo/pom.xml deleted file mode 100644 index 3ef0bcfbf5..0000000000 --- a/branches/sca-android/samples/databinding-echo/pom.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-databinding - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - sample-binding-echo - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-wsdl-xml - 1.4-SNAPSHOT - - - - junit - junit - 4.2 - test - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentAImpl.java deleted file mode 100644 index 5679614164..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.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/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/ComponentBImpl.java deleted file mode 100644 index ff8968837d..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.AllowsPassByReference; -import org.osoa.sca.annotations.Constructor; -import org.osoa.sca.annotations.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/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Echo.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Echo.java deleted file mode 100644 index 25ecc90454..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Remotable; - -/** - * @version $Rev$ $Date$ - */ - -@DataBinding("org.w3c.dom.Node") -@Remotable -public interface Echo { - Object echo(Object msg); -} diff --git a/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/EchoDataBindingClient.java deleted file mode 100644 index 9ec3819899..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface1.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface1.java deleted file mode 100644 index 70b450e358..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Remotable; - -/** - * @version $Rev$ $Date$ - */ -@DataBinding("java.lang.String") -@Remotable -public interface Interface1 { - String call(String msg); - String call1(String msg); -} diff --git a/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface2.java b/branches/sca-android/samples/databinding-echo/src/main/java/dbecho/Interface2.java deleted file mode 100644 index b62f1f425d..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite b/branches/sca-android/samples/databinding-echo/src/main/resources/EchoDataBinding.composite deleted file mode 100644 index 30b77a6152..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl b/branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl deleted file mode 100644 index ef2308aa73..0000000000 --- a/branches/sca-android/samples/databinding-echo/src/main/resources/wsdl/echo.wsdl +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/branches/sca-android/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java b/branches/sca-android/samples/databinding-echo/src/test/java/dbecho/EchoDataBindingTestCase.java deleted file mode 100644 index 43434d8cee..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/README b/branches/sca-android/samples/implementation-composite/README deleted file mode 100644 index 27de00e8ef..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/build.xml b/branches/sca-android/samples/implementation-composite/build.xml deleted file mode 100644 index 7aa31aab8b..0000000000 --- a/branches/sca-android/samples/implementation-composite/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-composite/implementation-composite.png b/branches/sca-android/samples/implementation-composite/implementation-composite.png deleted file mode 100644 index 4c6d71bc03..0000000000 Binary files a/branches/sca-android/samples/implementation-composite/implementation-composite.png and /dev/null differ diff --git a/branches/sca-android/samples/implementation-composite/implementation-composite.svg b/branches/sca-android/samples/implementation-composite/implementation-composite.svg deleted file mode 100644 index 0e60354aab..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/pom.xml b/branches/sca-android/samples/implementation-composite/pom.xml deleted file mode 100644 index 229061acb1..0000000000 --- a/branches/sca-android/samples/implementation-composite/pom.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.4-SNAPSHOT - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/implementation-composite/src/main/java/composite/CompositeClient.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/CompositeClient.java deleted file mode 100644 index bf743e1797..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/src/main/java/composite/Source.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/Source.java deleted file mode 100644 index d0efcc1df1..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceCallback.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceCallback.java deleted file mode 100644 index baa95a8e39..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceImpl.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/SourceImpl.java deleted file mode 100644 index b9a0c7ff74..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.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/branches/sca-android/samples/implementation-composite/src/main/java/composite/Target.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/Target.java deleted file mode 100644 index 9a8f68a7fa..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Callback; -import org.osoa.sca.annotations.OneWay; - - -@Callback(SourceCallback.class) -public interface Target { - - @OneWay - void someMethod(String arg); -} diff --git a/branches/sca-android/samples/implementation-composite/src/main/java/composite/TargetImpl.java b/branches/sca-android/samples/implementation-composite/src/main/java/composite/TargetImpl.java deleted file mode 100644 index 86686e9233..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Callback; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.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/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite b/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite deleted file mode 100644 index 3376ac8ff5..0000000000 --- a/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite.composite +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite b/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite deleted file mode 100644 index c9eff4fa9d..0000000000 --- a/branches/sca-android/samples/implementation-composite/src/main/resources/InnerComposite2.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml b/branches/sca-android/samples/implementation-composite/src/main/resources/META-INF/sca-contribution.xml deleted file mode 100644 index e675fd3624..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite b/branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite deleted file mode 100644 index cb1c1e13d4..0000000000 --- a/branches/sca-android/samples/implementation-composite/src/main/resources/OuterComposite.composite +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java b/branches/sca-android/samples/implementation-composite/src/test/java/composite/CompositeTestCase.java deleted file mode 100644 index 9e9a4b44a4..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/README b/branches/sca-android/samples/implementation-crud-extension/README deleted file mode 100644 index 5e8190648f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/build.xml b/branches/sca-android/samples/implementation-crud-extension/build.xml deleted file mode 100644 index 88d308e6fc..0000000000 --- a/branches/sca-android/samples/implementation-crud-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-crud-extension/pom.xml b/branches/sca-android/samples/implementation-crud-extension/pom.xml deleted file mode 100644 index c11953f0ac..0000000000 --- a/branches/sca-android/samples/implementation-crud-extension/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.4-SNAPSHOT - test - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUD.java deleted file mode 100644 index b23d85887b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java deleted file mode 100644 index 49be844f93..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java deleted file mode 100644 index fa83c63c1b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java deleted file mode 100644 index cc0795a735..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationFactoryImpl.java deleted file mode 100644 index 2f1e5fcba8..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java deleted file mode 100644 index 383a035e69..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationInvoker.java deleted file mode 100644 index b212ee3c9b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java deleted file mode 100644 index 8f11f9d910..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/branches/sca-android/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java deleted file mode 100644 index 4566cb7155..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory b/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/crud.CRUDImplementationFactory deleted file mode 100644 index 3cf5de5fa1..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-android/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index 6ce605197a..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd b/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd deleted file mode 100644 index 447e31bf93..0000000000 --- a/branches/sca-android/samples/implementation-crud-extension/src/main/resources/sample-implementation-crud.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/branches/sca-android/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java deleted file mode 100644 index 0bb5cfc361..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite b/branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite deleted file mode 100644 index 18745033bb..0000000000 --- a/branches/sca-android/samples/implementation-crud-extension/src/test/resources/crud.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-crud/README b/branches/sca-android/samples/implementation-crud/README deleted file mode 100644 index 50da631c04..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud/build.xml b/branches/sca-android/samples/implementation-crud/build.xml deleted file mode 100644 index 10b26b5a94..0000000000 --- a/branches/sca-android/samples/implementation-crud/build.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-crud/implementation-crud.png b/branches/sca-android/samples/implementation-crud/implementation-crud.png deleted file mode 100644 index a292037e7a..0000000000 Binary files a/branches/sca-android/samples/implementation-crud/implementation-crud.png and /dev/null differ diff --git a/branches/sca-android/samples/implementation-crud/implementation-crud.svg b/branches/sca-android/samples/implementation-crud/implementation-crud.svg deleted file mode 100644 index dbb37be208..0000000000 --- a/branches/sca-android/samples/implementation-crud/implementation-crud.svg +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - crud - - CRUDServiceComponent - CRUD - diff --git a/branches/sca-android/samples/implementation-crud/pom.xml b/branches/sca-android/samples/implementation-crud/pom.xml deleted file mode 100644 index 3cc75a6f7d..0000000000 --- a/branches/sca-android/samples/implementation-crud/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - sample-implementation-crud-extension - 1.4-SNAPSHOT - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java b/branches/sca-android/samples/implementation-crud/src/main/java/crud/client/CRUDClient.java deleted file mode 100644 index ea87cb3001..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite b/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite deleted file mode 100644 index 18745033bb..0000000000 --- a/branches/sca-android/samples/implementation-crud/src/main/resources/crud.composite +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java b/branches/sca-android/samples/implementation-crud/src/test/java/crud/client/CRUDTestCase.java deleted file mode 100644 index 7e0476a8b1..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/README b/branches/sca-android/samples/implementation-pojo-extension/README deleted file mode 100644 index 3b201779e1..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/build.xml b/branches/sca-android/samples/implementation-pojo-extension/build.xml deleted file mode 100644 index 78bae79859..0000000000 --- a/branches/sca-android/samples/implementation-pojo-extension/build.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-pojo-extension/pom.xml b/branches/sca-android/samples/implementation-pojo-extension/pom.xml deleted file mode 100644 index d7bb120e93..0000000000 --- a/branches/sca-android/samples/implementation-pojo-extension/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-interface-java-xml - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-core-spi - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-embedded - 1.4-SNAPSHOT - test - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementation.java deleted file mode 100644 index 7c2f5d236f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/POJOImplementationFactory.java deleted file mode 100644 index bbcfb3d0dc..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationFactoryImpl.java deleted file mode 100644 index 0dad270a6c..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationImpl.java deleted file mode 100644 index f2d6871039..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/impl/POJOImplementationProcessor.java deleted file mode 100644 index 44a2cc0aa8..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationInvoker.java deleted file mode 100644 index 87333c61f6..0000000000 --- a/branches/sca-android/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.osoa.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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProvider.java deleted file mode 100644 index 73a0d22493..0000000000 --- a/branches/sca-android/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.osoa.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/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java b/branches/sca-android/samples/implementation-pojo-extension/src/main/java/pojo/provider/POJOImplementationProviderFactory.java deleted file mode 100644 index 22f2be09e9..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/branches/sca-android/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/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory deleted file mode 100644 index b30ea3b9cf..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory b/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/META-INF/services/pojo.POJOImplementationFactory deleted file mode 100644 index 075af98240..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd b/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd deleted file mode 100644 index c9d170770b..0000000000 --- a/branches/sca-android/samples/implementation-pojo-extension/src/main/resources/sample-implementation-pojo.xsd +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java b/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorld.java deleted file mode 100644 index cc32929f09..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java b/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl.java deleted file mode 100644 index 0580e30aba..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java b/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldImpl2.java deleted file mode 100644 index 69ab1f567e..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java b/branches/sca-android/samples/implementation-pojo-extension/src/test/java/helloworld/HelloWorldTestCase.java deleted file mode 100644 index d8b5f41adc..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType b/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/HelloWorldImpl2.componentType deleted file mode 100644 index a92c5ab8db..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite b/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite deleted file mode 100644 index c38094dfc9..0000000000 --- a/branches/sca-android/samples/implementation-pojo-extension/src/test/resources/helloworld/helloworld.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/pom.xml b/branches/sca-android/samples/pom.xml deleted file mode 100644 index e7af01dbac..0000000000 --- a/branches/sca-android/samples/pom.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-SNAPSHOT - ../pom.xml - - tuscany-samples - pom - Apache Tuscany SCA Samples - - - - apache.incubator - http://people.apache.org/repo/m2-incubating-repository - - - - - - default - - true - - - binding-echo - binding-echo-extension - calculator - calculator-lean - databinding-echo - implementation-composite - implementation-crud - implementation-crud-extension - implementation-pojo-extension - simple-bigbank - simple-callback - supplychain - - - - - diff --git a/branches/sca-android/samples/simple-bigbank/README b/branches/sca-android/samples/simple-bigbank/README deleted file mode 100644 index acbe93a4d3..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/build.xml b/branches/sca-android/samples/simple-bigbank/build.xml deleted file mode 100644 index a814014eae..0000000000 --- a/branches/sca-android/samples/simple-bigbank/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/simple-bigbank/pom.xml b/branches/sca-android/samples/simple-bigbank/pom.xml deleted file mode 100644 index bb99d5cd6c..0000000000 --- a/branches/sca-android/samples/simple-bigbank/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/simple-bigbank/simple-bigbank.png b/branches/sca-android/samples/simple-bigbank/simple-bigbank.png deleted file mode 100644 index 593c047f6a..0000000000 Binary files a/branches/sca-android/samples/simple-bigbank/simple-bigbank.png and /dev/null differ diff --git a/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg b/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg deleted file mode 100644 index c64f6de6b9..0000000000 --- a/branches/sca-android/samples/simple-bigbank/simple-bigbank.svg +++ /dev/null @@ -1,200 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - BigBank - - AccountServiceComponent - - - - - AccountDataServiceComponent - - - currency AccountService - diff --git a/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountReport.java deleted file mode 100644 index 1625ff5b65..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountService.java deleted file mode 100644 index 7c9082b944..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/account/AccountServiceImpl.java deleted file mode 100644 index fa85f309c0..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/Account.java deleted file mode 100644 index a5ae7b3955..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataService.java deleted file mode 100644 index c354de387b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java deleted file mode 100644 index 000acb935c..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java deleted file mode 100644 index 11bdff757e..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java deleted file mode 100644 index b791024076..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/accountdata/StockAccount.java deleted file mode 100644 index 86246a3f84..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/client/BigBankClient.java deleted file mode 100644 index edbf910d37..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java deleted file mode 100644 index 0512d40b0b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/branches/sca-android/samples/simple-bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java deleted file mode 100644 index 7961279352..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Remotable; - - -/** - * This is the business interface of the StockQuote service. - */ -@Remotable -public interface StockQuoteService { - - public double getQuote(String symbol); -} - diff --git a/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite b/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite deleted file mode 100644 index e71615e27e..0000000000 --- a/branches/sca-android/samples/simple-bigbank/src/main/resources/Account.composite +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - USD - - - - - - - - - diff --git a/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite b/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite deleted file mode 100644 index c870f39cab..0000000000 --- a/branches/sca-android/samples/simple-bigbank/src/main/resources/BigBank.composite +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite b/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite deleted file mode 100644 index 4f29c14851..0000000000 --- a/branches/sca-android/samples/simple-bigbank/src/main/resources/StockQuote.composite +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - diff --git a/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java b/branches/sca-android/samples/simple-bigbank/src/test/java/bigbank/BigBankTestCase.java deleted file mode 100644 index ba6c1dd797..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-callback/README b/branches/sca-android/samples/simple-callback/README deleted file mode 100644 index 719376f254..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-callback/build.xml b/branches/sca-android/samples/simple-callback/build.xml deleted file mode 100644 index 47d1ea4bc1..0000000000 --- a/branches/sca-android/samples/simple-callback/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/simple-callback/pom.xml b/branches/sca-android/samples/simple-callback/pom.xml deleted file mode 100644 index 3a449dade9..0000000000 --- a/branches/sca-android/samples/simple-callback/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/simple-callback/simple-callback.png b/branches/sca-android/samples/simple-callback/simple-callback.png deleted file mode 100644 index 1b6353f5cf..0000000000 Binary files a/branches/sca-android/samples/simple-callback/simple-callback.png and /dev/null differ diff --git a/branches/sca-android/samples/simple-callback/simple-callback.svg b/branches/sca-android/samples/simple-callback/simple-callback.svg deleted file mode 100644 index 484b65df9d..0000000000 --- a/branches/sca-android/samples/simple-callback/simple-callback.svg +++ /dev/null @@ -1,150 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - simplecallback - MyServiceComponent - - - MyClientComponent - - - diff --git a/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClient.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClient.java deleted file mode 100644 index 4cc00d6d0f..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyClientImpl.java deleted file mode 100644 index 3e2a1df5a5..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.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/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyService.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyService.java deleted file mode 100644 index e78ad6f68f..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Callback; -import org.osoa.sca.annotations.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/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceCallback.java deleted file mode 100644 index b27eea44f5..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/MyServiceImpl.java deleted file mode 100644 index fc5e31d14e..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.Callback; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.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/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java b/branches/sca-android/samples/simple-callback/src/main/java/simplecallback/SimpleCallbackClient.java deleted file mode 100644 index b8987fcd07..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite b/branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite deleted file mode 100644 index 33e6f60601..0000000000 --- a/branches/sca-android/samples/simple-callback/src/main/resources/simplecallback.composite +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java b/branches/sca-android/samples/simple-callback/src/test/java/simplecallback/SimpleCallbackTestCase.java deleted file mode 100644 index cbaab8af83..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/README b/branches/sca-android/samples/supplychain/README deleted file mode 100644 index ea4493fdd4..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/build.xml b/branches/sca-android/samples/supplychain/build.xml deleted file mode 100644 index 506180b8b1..0000000000 --- a/branches/sca-android/samples/supplychain/build.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/supplychain/pom.xml b/branches/sca-android/samples/supplychain/pom.xml deleted file mode 100644 index 0b5a76be4c..0000000000 --- a/branches/sca-android/samples/supplychain/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 1.4-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 - 1.4-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 1.4-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - - diff --git a/branches/sca-android/samples/supplychain/src/main/java/supplychain/Customer.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/Customer.java deleted file mode 100644 index 8088001898..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/CustomerComponentImpl.java deleted file mode 100644 index 7a1e8553ec..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/supplychain/src/main/java/supplychain/Retailer.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/Retailer.java deleted file mode 100644 index 1add63fb4e..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/RetailerComponentImpl.java deleted file mode 100644 index f622052cf8..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/supplychain/src/main/java/supplychain/Shipper.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/Shipper.java deleted file mode 100644 index d4d49a922b..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/ShipperComponentImpl.java deleted file mode 100644 index 4ae52a12a2..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/SupplyChainClient.java deleted file mode 100644 index 7072f582d1..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/src/main/java/supplychain/Warehouse.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/Warehouse.java deleted file mode 100644 index 0be499f569..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java b/branches/sca-android/samples/supplychain/src/main/java/supplychain/WarehouseComponentImpl.java deleted file mode 100644 index b5e256a1e0..0000000000 --- a/branches/sca-android/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.osoa.sca.annotations.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/branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite b/branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite deleted file mode 100644 index 301efcaf1f..0000000000 --- a/branches/sca-android/samples/supplychain/src/main/resources/supplychain.composite +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java b/branches/sca-android/samples/supplychain/src/test/java/supplychain/SupplyChainClientTestCase.java deleted file mode 100644 index 88e0eb7ab8..0000000000 --- a/branches/sca-android/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/branches/sca-android/samples/supplychain/supplychain.png b/branches/sca-android/samples/supplychain/supplychain.png deleted file mode 100644 index 51a384e827..0000000000 Binary files a/branches/sca-android/samples/supplychain/supplychain.png and /dev/null differ diff --git a/branches/sca-android/samples/supplychain/supplychain.svg b/branches/sca-android/samples/supplychain/supplychain.svg deleted file mode 100644 index f72e77acab..0000000000 --- a/branches/sca-android/samples/supplychain/supplychain.svg +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - supplychain - - CustomerComponent - - - RetailerComponent - - - WharehouseComponent - - - ShipperComponent - - - - - - - -- cgit v1.2.3